fix(rebase): rebase a dossier when its repetition had been removed on newer version does not crash

This commit is contained in:
Martin 2024-03-08 15:55:50 +01:00
parent 0e54ca314d
commit 4a26b61d1b
2 changed files with 4 additions and 1 deletions

View file

@ -71,7 +71,9 @@ module DossierRebaseConcern
.each { add_new_champs_for_revision(_1) }
# remove champ
changes_by_op[:remove].each { champs_by_stable_id[_1.stable_id].destroy_all }
children_champ, root_champ = changes_by_op[:remove].partition(&:child?)
children_champ.each { champs_by_stable_id[_1.stable_id].delete_all }
root_champ.each { champs_by_stable_id[_1.stable_id].delete_all }
# update champ
changes_by_op[:update].each { apply(_1, champs_by_stable_id[_1.stable_id]) }

View file

@ -7,6 +7,7 @@ class ProcedureRevisionChange
def label = @type_de_champ.libelle
def stable_id = @type_de_champ.stable_id
def private? = @type_de_champ.private?
def child? = @type_de_champ.child?
def to_h = { op:, stable_id:, label:, private: private? }