Skip to content

Commit

Permalink
Update segment_count if null
Browse files Browse the repository at this point in the history
  • Loading branch information
kookster committed Dec 21, 2024
1 parent 1515f92 commit fb4a998
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/models/episode.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@ def image=(file)

def set_defaults
guid
self.segment_count ||= 1 if new_record? && strict_validations
if new_record? && strict_validations
self.segment_count ||= 1
elsif segment_count.blank? && contents.any?
self.segment_count = contents.map(&:position).max || contents.size
end
end

def guid
Expand Down

0 comments on commit fb4a998

Please sign in to comment.