Skip to content

Commit

Permalink
fix setting cadence in import script
Browse files Browse the repository at this point in the history
  • Loading branch information
mcfiredrill committed Oct 1, 2023
1 parent 313e489 commit 2a29165
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions script/convert_show_to_show_series.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
guest_series.save!

def get_weekday_cadence_from_month date
day_of_month = date.day
day_of_month = date.day
day_of_week = date.wday
first_day = day_of_month - day_of_week
position = (first_day / 7).floor + 1
Expand All @@ -22,7 +22,7 @@ def get_weekday_cadence_from_month date
elsif position == 4 || (position == 5 && day_of_month + 7 > Date.new(date.year, date.month + 1, 0).day)
return 'Last'
else
return 'Fourth'
return 'Forth'
end
end

Expand All @@ -34,8 +34,8 @@ def get_weekday_cadence_from_month date
puts "creating show series for #{show.title}"
show_series = ShowSeries.new title: show.title, description: show.description, recurring_interval: show.recurring_interval, start_time: show.start_at, end_time: show.end_at, start_date: show.start_at, status: "disabled"
show_series.recurring_weekday = show.start_at.strftime("%A")
if show_series.recurring_interval === :month
show_series.recurring_cadence get_weekday_cadence_from_month(show.start_at)
if show_series.month?
show_series.recurring_cadence = get_weekday_cadence_from_month(show.start_at)
end
if show_series.description.blank?
show_series.description = show_series.title
Expand Down

0 comments on commit 2a29165

Please sign in to comment.