Files
fizzy/script/migrations/backfill_weekly_highlights.rb
T
Jorge Manrubia 3e67da7d0e Add a new join model to link summaries with users
So that changing the set of events does not result in not being able to find a generated highlight summary
2025-10-06 12:33:28 +02:00

17 lines
373 B
Ruby

#!/usr/bin/env ruby
require_relative "../config/environment"
WEEKS_TO_BACKFILL = 3
ActiveRecord::Base.logger = Logger.new(File::NULL)
ApplicationRecord.with_each_tenant do |tenant|
PeriodHighlights.destroy_all
WEEKS_TO_BACKFILL.times do |index|
User.active.find_each do |user|
user.generate_weekly_highlights(Time.current - index.weeks)
end
end
end