Skip to content
Snippets Groups Projects
Unverified Commit d43119c7 authored by Jan Kessler's avatar Jan Kessler Committed by GitHub
Browse files

update changed recording URLs of already present formats instead of creating...

update changed recording URLs of already present formats instead of creating new format entries (#5460)
parent 76dffcd0
No related branches found
No related tags found
No related merge requests found
...@@ -80,11 +80,11 @@ class RecordingCreator ...@@ -80,11 +80,11 @@ class RecordingCreator
def create_formats(recording:, new_recording:) def create_formats(recording:, new_recording:)
if recording[:playback][:format].is_a?(Array) if recording[:playback][:format].is_a?(Array)
recording[:playback][:format].each do |format| recording[:playback][:format].each do |format|
Format.find_or_create_by(recording_id: new_recording.id, recording_type: format[:type], url: format[:url]) Format.find_or_create_by(recording_id: new_recording.id, recording_type: format[:type]).update(url: format[:url])
end end
else else
Format.find_or_create_by(recording_id: new_recording.id, recording_type: recording[:playback][:format][:type], Format.find_or_create_by(recording_id: new_recording.id,
url: recording[:playback][:format][:url]) recording_type: recording[:playback][:format][:type]).update(url: recording[:playback][:format][:url])
end end
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment