2017-05-12 17:41:03 +02:00
|
|
|
class WeeklyOverviewWorker
|
|
|
|
def perform(*args)
|
2017-09-26 15:32:03 +02:00
|
|
|
Rails.logger.info("WeeklyOverviewWorker started at #{Time.now}")
|
2017-05-19 16:21:11 +02:00
|
|
|
# Feature flipped to avoid mails in staging due to unprocessed dossier
|
|
|
|
if Features.weekly_overview
|
|
|
|
Gestionnaire.all
|
|
|
|
.map { |gestionnaire| [gestionnaire, gestionnaire.last_week_overview] }
|
|
|
|
.reject { |_, overview| overview.nil? }
|
|
|
|
.each { |gestionnaire, overview| GestionnaireMailer.last_week_overview(gestionnaire, overview).deliver_now }
|
|
|
|
end
|
2017-09-26 15:32:03 +02:00
|
|
|
Rails.logger.info("WeeklyOverviewWorker ended at #{Time.now}")
|
|
|
|
end
|
|
|
|
|
|
|
|
def queue_name
|
|
|
|
"cron"
|
2017-05-12 17:41:03 +02:00
|
|
|
end
|
2017-09-26 15:32:03 +02:00
|
|
|
|
|
|
|
handle_asynchronously :perform
|
2017-05-12 17:41:03 +02:00
|
|
|
end
|