fix(champ): rewire champ.mandatory? to type_de_champ.mandatory?

it fixes behaviour in drop_down_list_component which add option if not mandatory (!= not required)
This commit is contained in:
simon lehericey 2022-10-17 10:16:30 +02:00 committed by LeSim
parent 528b7ec3f8
commit 7114623285

View file

@ -60,6 +60,7 @@ class Champ < ApplicationRecord
:rna?,
:siret?,
:stable_id,
:mandatory?,
to: :type_de_champ
scope :updated_since?, -> (date) { where('champs.updated_at > ?', date) }
@ -93,10 +94,6 @@ class Champ < ApplicationRecord
@sections ||= dossier.sections_for(self)
end
def mandatory?
type_de_champ.mandatory? && visible?
end
# used for the `required` html attribute
# check visibility to avoid hidden required input
# which prevent the form from being sent.