[Fix #1545] Rake task to send accusés de réception that were missed
(because of #1510)
This commit is contained in:
parent
988af5ae37
commit
b39cd48d6f
1 changed files with 22 additions and 0 deletions
22
lib/tasks/2018_03_08_send_missed_accuse_reception.rake
Normal file
22
lib/tasks/2018_03_08_send_missed_accuse_reception.rake
Normal file
|
@ -0,0 +1,22 @@
|
|||
namespace :'2018_03_08_send_missing_accuse_reception' do
|
||||
task send: :environment do
|
||||
# Send accusés de réception that were missed because of #1510
|
||||
#
|
||||
# The bug was introduced in production with the 2018-03-01-01 release
|
||||
# and fixed with the 2018-03-05-03 release.
|
||||
#
|
||||
# `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.
|
||||
|
||||
bug_date = DateTime.new(2018, 3, 1, 9, 15)
|
||||
fix_date = DateTime.new(2018, 3, 5, 18, 35)
|
||||
|
||||
# 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
|
||||
# accusé de réception would add more confusion than it’s worth
|
||||
problem_dossiers = Dossier.state_en_construction.where(en_construction_at: bug_date..fix_date)
|
||||
problem_dossiers.find_each do |dossier|
|
||||
NotificationMailer.send_notification(dossier, dossier.procedure.initiated_mail_template).deliver_now!
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue