demarches-normaliennes/app/workers/weekly_overview_worker.rb
Simon Lehericey b48549d765 WeeklyOverviewWorker: add feature flip on worker
The main objective is to avoid batch mail sent in staging
2017-05-23 17:12:18 +02:00

13 lines
468 B
Ruby

class WeeklyOverviewWorker
include Sidekiq::Worker
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