Skip to content

Commit

Permalink
return empty transcript when missing
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienpoly committed Jul 9, 2024
1 parent 3f826de commit c3d36d2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/serializers/transcript_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c3d36d2

Please sign in to comment.