demarches-normaliennes/app/jobs/weekly_overview_job.rb

14 lines
498 B
Ruby
Raw Normal View History

2020-03-28 16:49:40 +01:00
class WeeklyOverviewJob < CronJob
self.schedule_expression = "every monday at 7 am"
2017-10-03 16:19:25 +02:00
def perform(*args)
# Feature flipped to avoid mails in staging due to unprocessed dossier
if Rails.application.config.ds_weekly_overview
Instructeur.all
.map { |instructeur| [instructeur, instructeur.last_week_overview] }
.reject { |_, overview| overview.nil? }
.each { |instructeur, _| InstructeurMailer.last_week_overview(instructeur).deliver_later }
end
end
end