From c3d36d2202c14efa5d45978f5c4eb4ae38779cbf Mon Sep 17 00:00:00 2001 From: Adrien POLY Date: Tue, 9 Jul 2024 09:08:57 +0200 Subject: [PATCH] return empty transcript when missing --- app/serializers/transcript_serializer.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/serializers/transcript_serializer.rb b/app/serializers/transcript_serializer.rb index ae5a9b99..ccc65dce 100644 --- a/app/serializers/transcript_serializer.rb +++ b/app/serializers/transcript_serializer.rb @@ -4,10 +4,10 @@ def self.dump(transcript) end def self.load(transcript_json) - return nil if transcript_json.nil? || transcript_json.empty? + transcript = Transcript.new + return transcript if transcript_json.nil? || transcript_json.empty? cues_array = JSON.parse(transcript_json, symbolize_names: true) - transcript = Transcript.new cues_array.each do |cue_hash| transcript.add_cue(Cue.new(cue_hash[:start_time], cue_hash[:end_time], cue_hash[:text])) end