feat(routing): update method checking if routling rule match tdc

This commit is contained in:
Eric Leroy-Terquem 2023-07-26 17:28:28 +02:00
parent 7680d5093e
commit 155a797aba
2 changed files with 10 additions and 1 deletions

View file

@ -117,7 +117,8 @@ class GroupeInstructeur < ApplicationRecord
def routing_rule_matches_tdc?
routing_tdc = procedure.active_revision.types_de_champ.find_by(stable_id: routing_rule.left.stable_id)
routing_rule.right.value.in?(routing_tdc.options['drop_down_options'])
options = routing_tdc.options_with_drop_down_other
routing_rule.right.value.in?(options)
end
serialize :routing_rule, LogicSerializer

View file

@ -517,6 +517,14 @@ class TypeDeChamp < ApplicationRecord
(drop_down_list_options - drop_down_list_disabled_options).reject(&:empty?)
end
def options_with_drop_down_other
if drop_down_other?
drop_down_options + [Champs::DropDownListChamp::OTHER]
else
drop_down_options
end
end
def layer_enabled?(layer)
options && options[layer] && options[layer] != '0'
end