From f485f144fc9b81286339410bb33566dc00898d9f Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Mon, 15 May 2023 10:21:54 +0200 Subject: [PATCH] chore(procedure): log dossiers before reset --- app/models/procedure.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/procedure.rb b/app/models/procedure.rb index 721989908..42bf32233 100644 --- a/app/models/procedure.rb +++ b/app/models/procedure.rb @@ -403,9 +403,12 @@ class Procedure < ApplicationRecord end def reset! - return false if !locked? || draft_changed? - draft_revision.dossiers.destroy_all + dossier_ids_to_destroy = draft_revision.dossiers.ids + if dossier_ids_to_destroy.present? + Rails.logger.info("Resetting #{dossier_ids_to_destroy.size} dossiers on procedure #{id}: #{dossier_ids_to_destroy}") + draft_revision.dossiers.destroy_all + end end end