Skip to content

Commit

Permalink
fix convert_show_to_show_series script
Browse files Browse the repository at this point in the history
  • Loading branch information
mcfiredrill committed Aug 30, 2023
1 parent 335f375 commit 4a0e2a0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions script/convert_show_to_show_series.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
guest_series.save!

shows.find_each do |show|
if show.recurrences.count > 0 && show.recurrant_original_id.nil? && show.recurring_interval != "not_recurring"
recurrences = show.radio.scheduled_shows.where(recurrant_original_id: show.id)
if recurrences.count > 0 && show.recurrant_original_id.nil? && show.recurring_interval != "not_recurring"
if show.dj.present?
# create a show series that repeats
puts "creating show series for #{show.title}"
Expand All @@ -24,9 +25,9 @@
end
end
show_series.save!
show.recurrences.update_all show_series_id: show_series.id
recurrences.update_all show_series_id: show_series.id
# TODO should we publish all archives???
show.recurrences.where("start_at <= ?", Time.now).find_each do |s|
recurrences.where("start_at <= ?", Time.now).find_each do |s|
if s.tracks.any?
# publish if show has tracks associated
s.update status: "archive_published"
Expand Down

0 comments on commit 4a0e2a0

Please sign in to comment.