fix(dossier): add champs to dossiers in factories
This commit is contained in:
parent
b3701a12b4
commit
7462a43886
1 changed files with 3 additions and 3 deletions
|
@ -295,7 +295,7 @@ def dossier_factory_create_champ_or_repetition(type_de_champ, dossier)
|
||||||
types_de_champ = dossier.revision.children_of(type_de_champ)
|
types_de_champ = dossier.revision.children_of(type_de_champ)
|
||||||
2.times do
|
2.times do
|
||||||
row_id = ULID.generate
|
row_id = ULID.generate
|
||||||
type_de_champ.build_champ(dossier:, row_id:).save!
|
dossier.champs << type_de_champ.build_champ(row_id:)
|
||||||
types_de_champ.each do |type_de_champ|
|
types_de_champ.each do |type_de_champ|
|
||||||
dossier_factory_create_champ(type_de_champ, dossier, row_id:)
|
dossier_factory_create_champ(type_de_champ, dossier, row_id:)
|
||||||
end
|
end
|
||||||
|
@ -313,6 +313,6 @@ def dossier_factory_create_champ(type_de_champ, dossier, row_id: nil)
|
||||||
elsif type_de_champ.multiple_drop_down_list?
|
elsif type_de_champ.multiple_drop_down_list?
|
||||||
type_de_champ.drop_down_options.first(2).to_json
|
type_de_champ.drop_down_options.first(2).to_json
|
||||||
end
|
end
|
||||||
attrs = { stable_id: type_de_champ.stable_id, private: type_de_champ.private?, row_id:, dossier:, value: }.compact
|
attrs = { stable_id: type_de_champ.stable_id, private: type_de_champ.private?, row_id:, value: }.compact
|
||||||
create(:"champ_do_not_use_#{type_de_champ.type_champ}", **attrs)
|
dossier.champs << build(:"champ_do_not_use_#{type_de_champ.type_champ}", **attrs)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue