mailers: fix last_week_overview crash when the overview is missing
This is because procedures may be unpublished between the time where the job is enqueued and the time the mailer is run Fix #3745
This commit is contained in:
parent
c0a9f103b3
commit
8ca683c515
2 changed files with 15 additions and 3 deletions
|
@ -21,11 +21,13 @@ class GestionnaireMailer < ApplicationMailer
|
|||
|
||||
def last_week_overview(gestionnaire)
|
||||
email = gestionnaire.email
|
||||
@overview = gestionnaire.last_week_overview
|
||||
headers['X-mailjet-campaign'] = 'last_week_overview'
|
||||
@subject = 'Votre activité hebdomadaire'
|
||||
@overview = gestionnaire.last_week_overview
|
||||
|
||||
mail(to: email, subject: @subject)
|
||||
if @overview.present?
|
||||
headers['X-mailjet-campaign'] = 'last_week_overview'
|
||||
mail(to: email, subject: @subject)
|
||||
end
|
||||
end
|
||||
|
||||
def send_dossier(sender, dossier, recipient)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue