[#1545] Also notify dossiers that are not en construction

This forces us to have more precise bug and fix times
This commit is contained in:
Frederic Merizen 2018-03-09 17:18:53 +01:00
parent b39cd48d6f
commit 1b889a4100

View file

@ -8,13 +8,13 @@ namespace :'2018_03_08_send_missing_accuse_reception' do
# `bug_date` and `fix_date` were determined empirically by looking at the release times, # `bug_date` and `fix_date` were determined empirically by looking at the release times,
# and checking for dossiers with a missing accusé de réception. # and checking for dossiers with a missing accusé de réception.
bug_date = DateTime.new(2018, 3, 1, 9, 15) bug_date = DateTime.new(2018, 3, 1, 9, 50)
fix_date = DateTime.new(2018, 3, 5, 18, 35) fix_date = DateTime.new(2018, 3, 5, 18, 40)
# Only send the accusé for dossiers that are still en construction. # Only send the accusé for dossiers that are still en construction.
# For dossiers that have moved on, other mails have been sent since, and a late # For dossiers that have moved on, other mails have been sent since, and a late
# accusé de réception would add more confusion than its worth # accusé de réception would add more confusion than its worth
problem_dossiers = Dossier.state_en_construction.where(en_construction_at: bug_date..fix_date) problem_dossiers = Dossier.where(en_construction_at: bug_date..fix_date)
problem_dossiers.find_each do |dossier| problem_dossiers.find_each do |dossier|
NotificationMailer.send_notification(dossier, dossier.procedure.initiated_mail_template).deliver_now! NotificationMailer.send_notification(dossier, dossier.procedure.initiated_mail_template).deliver_now!
end end