update dossier after saving avis

update last_avis_updated_at without hook

Co-authored-by: clemkeirua <clement@keiruaprod.fr>
This commit is contained in:
Christophe Robillard 2020-07-22 16:57:00 +02:00
parent f3a675c3bc
commit b940d2e1b0
4 changed files with 13 additions and 2 deletions

View file

@ -35,6 +35,7 @@ module CreateAvisConcern
persisted, failed = create_results.partition(&:persisted?)
if persisted.any?
dossier.update!(last_avis_updated_at: Time.zone.now)
sent_emails_addresses = []
persisted.each do |avis|
avis.dossier.demander_un_avis!(avis)

View file

@ -44,6 +44,7 @@ module Instructeurs
def update
if @avis.update(avis_params)
flash.notice = 'Votre réponse est enregistrée.'
@avis.dossier.update!(last_avis_updated_at: Time.zone.now)
redirect_to instruction_instructeur_avis_path(@avis.procedure, @avis)
else
flash.now.alert = @avis.errors.full_messages