a0ceee96bd
tech( Co-authored-by: Colin Darie <colin@darie.eu>
13 lines
463 B
Ruby
13 lines
463 B
Ruby
class Cron::WeeklyOverviewJob < Cron::CronJob
|
|
self.schedule_expression = "every monday at 4 am"
|
|
|
|
def perform
|
|
# Feature flipped to avoid mails in staging due to unprocessed dossier
|
|
return unless Rails.application.config.ds_weekly_overview
|
|
|
|
Instructeur.find_each do |instructeur|
|
|
# mailer won't send anything if overview if empty
|
|
InstructeurMailer.last_week_overview(instructeur)&.deliver_later(wait: rand(0..3.hours))
|
|
end
|
|
end
|
|
end
|