refactor(repetition): remove parent_id

This commit is contained in:
Paul Chavard 2024-09-27 15:44:57 +02:00
parent e7080c1ad1
commit bd32f5693d
No known key found for this signature in database
25 changed files with 72 additions and 222 deletions

View file

@ -81,20 +81,8 @@ class DossierPreloader
end
dossier.association(:champs).target = champs
# remove once parent_id is deprecated
champs_by_parent_id = champs.group_by(&:parent_id)
champs.each do |champ|
champ.association(:dossier).target = dossier
# remove once parent_id is deprecated
if champ.repetition?
children = champs_by_parent_id.fetch(champ.id, [])
children.each do |child|
child.association(:parent).target = champ
end
champ.association(:champs).target = children
end
end
# We need to do this because of the check on `Etablissement#champ` in