Merge pull request #2064 from betagouv/more-fixes

More fixes
This commit is contained in:
gregoirenovel 2018-06-07 17:53:51 +02:00 committed by GitHub
commit c4a6e74223
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 46 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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