refactor(repetition): remove parent_id
This commit is contained in:
parent
e7080c1ad1
commit
bd32f5693d
25 changed files with 72 additions and 222 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue