commit
c4a6e74223
4 changed files with 48 additions and 46 deletions
|
@ -1,5 +1,4 @@
|
|||
module Mailers
|
||||
class NewAttestationMailer < ApplicationMailer
|
||||
class NewAttestationMailer < ApplicationMailer
|
||||
include Rails.application.routes.url_helpers
|
||||
|
||||
def new_attestation(dossier)
|
||||
|
@ -29,5 +28,4 @@ module Mailers
|
|||
L’équipe demarches-simplifiees.fr
|
||||
HEREDOC
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
module Mailers
|
||||
class ResendAttestationMailer < ApplicationMailer
|
||||
class ResendAttestationMailer < ApplicationMailer
|
||||
include Rails.application.routes.url_helpers
|
||||
|
||||
def resend_attestation(dossier)
|
||||
|
@ -25,5 +24,4 @@ module Mailers
|
|||
L’équipe demarches-simplifiees.fr
|
||||
HEREDOC
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace :'2018_06_05_resend_attestations' do
|
|||
|
||||
dossier.attestation = dossier.build_attestation
|
||||
|
||||
Mailers::ResendAttestationMailer.resend_attestation(dossier).deliver_later
|
||||
ResendAttestationMailer.resend_attestation(dossier).deliver_later
|
||||
puts "Email envoyé à #{email} pour le dossier #{dossier.id}"
|
||||
end
|
||||
end
|
|
@ -33,12 +33,18 @@ namespace :'2018_06_05_send_new_attestation' do
|
|||
|
||||
dossiers.each do |dossier|
|
||||
attestation = dossier.attestation
|
||||
|
||||
if attestation
|
||||
id = attestation.id
|
||||
attestation.destroy
|
||||
puts "Attestation #{id} détruite"
|
||||
end
|
||||
|
||||
dossier.attestation = dossier.build_attestation
|
||||
|
||||
Mailers::NewAttestationMailer.new_attestation(dossier).deliver_later
|
||||
puts "Email envoyé à #{email} pour le dossier #{dossier.id}"
|
||||
NewAttestationMailer.new_attestation(dossier).deliver_later
|
||||
puts "Email envoyé à #{dossier.user.email} pour le dossier #{dossier.id}"
|
||||
puts
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue