refactor(logic): reuse compatible_type

This commit is contained in:
simon lehericey 2022-09-08 12:13:38 +02:00
parent 06c025b5a5
commit 478a7e68ab

View file

@ -178,14 +178,7 @@ class TypesDeChampEditor::ConditionsComponent < ApplicationComponent
end end
def current_right_valid?(left, right) def current_right_valid?(left, right)
case [left.type, right.type] Logic.compatible_type?(left, right)
in [:boolean, :boolean] | [:number, :number] | [:empty, :empty]
true
in [:enum, :string]
left.options.map(&:second).include?(right.value)
else
false
end
end end
def add_condition_tag def add_condition_tag