perf(champ_value): use champ_type instead of tdc.type_champ, -22ms

This commit is contained in:
simon lehericey 2022-10-13 15:01:46 +02:00 committed by LeSim
parent 2643bef77d
commit 73b4ee64e6

View file

@ -29,15 +29,16 @@ class Logic::ChampValue < Logic::Term
return nil if !targeted_champ.visible?
return nil if targeted_champ.blank?
case type_de_champ(champs.map(&:type_de_champ)).type_champ
when MANAGED_TYPE_DE_CHAMP.fetch(:yes_no),
MANAGED_TYPE_DE_CHAMP.fetch(:checkbox)
# on dépense 22ms ici, à cause du map, mais on doit pouvoir passer par un champ type
case targeted_champ.type
when "Champs::YesNoChamp",
"Champs::CheckboxChamp"
targeted_champ.true?
when MANAGED_TYPE_DE_CHAMP.fetch(:integer_number), MANAGED_TYPE_DE_CHAMP.fetch(:decimal_number)
when "Champs::IntegerNumberChamp", "Champs::DecimalNumberChamp"
targeted_champ.for_api
when MANAGED_TYPE_DE_CHAMP.fetch(:drop_down_list)
when "Champs::DropDownListChamp"
targeted_champ.selected
when MANAGED_TYPE_DE_CHAMP.fetch(:multiple_drop_down_list)
when "Champs::MultipleDropDownListChamp"
targeted_champ.selected_options
end
end