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
def current_right_valid?(left, right)
case [left.type, right.type]
in [:boolean, :boolean] | [:number, :number] | [:empty, :empty]
true
in [:enum, :string]
left.options.map(&:second).include?(right.value)
else
false
end
Logic.compatible_type?(left, right)
end
def add_condition_tag