demarches-normaliennes/app/jobs/weekly_overview_job.rb
2017-10-05 15:42:48 +02:00

13 lines
473 B
Ruby

class WeeklyOverviewJob < ApplicationJob
queue_as :cron
def perform(*args)
# 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
end
end