update dossier after saving champ

update last_champ_updated_at without hook
update last_champ_private_updated_at without hook

Co-authored-by: Christophe Robillard <christophe.robillard@beta.gouv.fr>
This commit is contained in:
clemkeirua 2020-07-22 17:11:33 +02:00 committed by Christophe Robillard
parent b940d2e1b0
commit c772c3454c
4 changed files with 74 additions and 16 deletions

View file

@ -345,7 +345,11 @@ module Users
errors = []
if champs_params[:dossier]
if !@dossier.update(champs_params[:dossier])
@dossier.assign_attributes(champs_params[:dossier])
if @dossier.champs.any?(&:changed?)
@dossier.last_champ_updated_at = Time.zone.now
end
if !@dossier.save
errors += @dossier.errors.full_messages
elsif change_groupe_instructeur?
groupe_instructeur = @dossier.procedure.groupe_instructeurs.find(params[:dossier][:groupe_instructeur_id])