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
|
2018-04-18 12:24:37 +02:00
|
|
|
if Flipflop.weekly_overview?
|
2017-05-19 16:21:11 +02:00
|
|
|
Gestionnaire.all
|
|
|
|
.map { |gestionnaire| [gestionnaire, gestionnaire.last_week_overview] }
|
|
|
|
.reject { |_, overview| overview.nil? }
|
2018-02-21 17:40:41 +01:00
|
|
|
.each { |gestionnaire, _| GestionnaireMailer.last_week_overview(gestionnaire).deliver_later }
|
2017-05-19 16:21:11 +02:00
|
|
|
end
|
2017-05-12 17:41:03 +02:00
|
|
|
end
|
|
|
|
end
|