2017-10-03 16:19:25 +02:00
|
|
|
class WeeklyOverviewJob < ApplicationJob
|
|
|
|
queue_as :cron
|
|
|
|
|
2017-05-12 17:41:03 +02:00
|
|
|
def perform(*args)
|
2017-05-19 16:21:11 +02:00
|
|
|
# Feature flipped to avoid mails in staging due to unprocessed dossier
|
2019-07-31 12:26:07 +02:00
|
|
|
if Rails.application.config.ds_weekly_overview
|
2019-08-06 11:02:54 +02:00
|
|
|
Instructeur.all
|
|
|
|
.map { |instructeur| [instructeur, instructeur.last_week_overview] }
|
2017-05-19 16:21:11 +02:00
|
|
|
.reject { |_, overview| overview.nil? }
|
2019-08-06 11:02:54 +02:00
|
|
|
.each { |instructeur, _| InstructeurMailer.last_week_overview(instructeur).deliver_later }
|
2017-05-19 16:21:11 +02:00
|
|
|
end
|
2017-05-12 17:41:03 +02:00
|
|
|
end
|
|
|
|
end
|