Merge pull request #8100 from tchak/cleanup-dead-code

chore(dossier): cleanup champs nested attributes
This commit is contained in:
Paul Chavard 2022-11-29 11:18:28 +01:00 committed by GitHub
commit 9a8c1ce224
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 12 deletions

View file

@ -394,11 +394,6 @@ module Users
champs_public_attributes: [
:id, :value, :value_other, :external_id, :primary_value, :secondary_value, :numero_allocataire, :code_postal, :identifiant, :numero_fiscal, :reference_avis, :ine, :piece_justificative_file, :departement, :code_departement, value: [],
champs_attributes: [:id, :_destroy, :value, :value_other, :external_id, :primary_value, :secondary_value, :numero_allocataire, :code_postal, :identifiant, :numero_fiscal, :reference_avis, :ine, :piece_justificative_file, :departement, :code_departement, value: []]
],
# FIXME: remove after migration
champs_attributes: [
:id, :value, :value_other, :external_id, :primary_value, :secondary_value, :numero_allocataire, :code_postal, :identifiant, :numero_fiscal, :reference_avis, :ine, :piece_justificative_file, :departement, :code_departement, value: [],
champs_attributes: [:id, :_destroy, :value, :value_other, :external_id, :primary_value, :secondary_value, :numero_allocataire, :code_postal, :identifiant, :numero_fiscal, :reference_avis, :ine, :piece_justificative_file, :departement, :code_departement, value: []]
]
})
end
@ -457,12 +452,7 @@ module Users
errors = []
if champs_params[:dossier]
# FIXME: remove after migration
dossier_params = champs_params[:dossier]
if dossier_params.key?(:champs_attributes)
dossier_params[:champs_public_attributes] = dossier_params.delete(:champs_attributes)
end
@dossier.assign_attributes(dossier_params)
@dossier.assign_attributes(champs_params[:dossier])
# FIXME: in some cases a removed repetition bloc row is submitted.
# In this case it will be treated as a new record, and the action will fail.
@dossier.champs_public.filter(&:block?).each do |champ|

View file

@ -20,7 +20,7 @@
# type_de_champ_id :integer
#
class Champs::RepetitionChamp < Champ
accepts_nested_attributes_for :champs, allow_destroy: true
accepts_nested_attributes_for :champs
delegate :libelle_for_export, to: :type_de_champ
def rows