fix(dossier): use traitements to send repasser_en_instruction template

This commit is contained in:
Paul Chavard 2023-11-14 16:49:50 +01:00
parent a2ed35d44e
commit 508602fd4a
2 changed files with 7 additions and 2 deletions

View file

@ -1,4 +1,6 @@
class Dossier < ApplicationRecord
self.ignored_columns += [:re_instructed_at]
include DossierCloneConcern
include DossierCorrectableConcern
include DossierFilteringConcern
@ -974,7 +976,6 @@ class Dossier < ApplicationRecord
self.sva_svr_decision_on = nil
self.motivation = nil
self.justificatif_motivation.purge_later
self.re_instructed_at = Time.zone.now
save!
rebase_later

View file

@ -594,7 +594,11 @@ class Procedure < ApplicationRecord
when Dossier.states.fetch(:en_construction)
initiated_mail_template
when Dossier.states.fetch(:en_instruction)
dossier.re_instructed_at.present? ? re_instructed_mail_template : received_mail_template
if dossier.traitements.where(state: Dossier.states.fetch(:en_instruction)).one?
received_mail_template
else
re_instructed_mail_template
end
when Dossier.states.fetch(:accepte)
closed_mail_template
when Dossier.states.fetch(:refuse)