Merge pull request #1839 from betagouv/frederic/fix_admin_attestation_mailing

Do not use deliver_late
This commit is contained in:
LeSim 2018-04-11 09:39:45 +02:00 committed by GitHub
commit d06b72fb80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,8 @@ namespace :'2018_04_03_attestation_closed_mail_discrepancy' do
Administrateur.includes(:procedures).find_each(batch_size: 10) do |admin|
procedures = admin.procedures.where(archived_at: nil).select { |p| p.closed_mail_template_attestation_inconsistency_state == :missing_tag }
if procedures.any?
Mailers::AttestationClosedMailDiscrepancyMailer.missing_attestation_tag_email(admin, procedures).deliver_later
# Use `deliver_now` because the delayed job cannot find the `Mailers::AttestationClosedMailDiscrepancyMaile` class in production
Mailers::AttestationClosedMailDiscrepancyMailer.missing_attestation_tag_email(admin, procedures).deliver_now!
print "#{admin.email}\n"
end
end