demarches-normaliennes/app/jobs/weekly_overview_job.rb

14 lines
459 B
Ruby
Raw Normal View History

2017-10-03 16:19:25 +02:00
class WeeklyOverviewJob < ApplicationJob
queue_as :cron
def perform(*args)
# Feature flipped to avoid mails in staging due to unprocessed dossier
2018-04-18 12:24:37 +02:00
if Flipflop.weekly_overview?
Gestionnaire.all
.map { |gestionnaire| [gestionnaire, gestionnaire.last_week_overview] }
.reject { |_, overview| overview.nil? }
.each { |gestionnaire, _| GestionnaireMailer.last_week_overview(gestionnaire).deliver_later }
end
end
end