add champ_value for dropdown
This commit is contained in:
parent
809d991819
commit
5ac3049033
4 changed files with 26 additions and 1 deletions
|
@ -16,6 +16,8 @@ module Logic
|
|||
case [left.type, right.type]
|
||||
in [a, ^a] # syntax for same type
|
||||
true
|
||||
in [:enum, :string]
|
||||
left.options.include?(right.value)
|
||||
else
|
||||
false
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ class Logic::ChampValue < Logic::Term
|
|||
champ(champs).true?
|
||||
when all_types.fetch(:integer_number), all_types.fetch(:decimal_number)
|
||||
champ(champs).for_api
|
||||
when all_types.fetch(:text)
|
||||
when all_types.fetch(:drop_down_list), all_types.fetch(:text)
|
||||
champ(champs).value
|
||||
end
|
||||
end
|
||||
|
@ -28,6 +28,8 @@ class Logic::ChampValue < Logic::Term
|
|||
:number
|
||||
when all_types.fetch(:text)
|
||||
:string
|
||||
when all_types.fetch(:drop_down_list)
|
||||
:enum
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -54,6 +56,10 @@ class Logic::ChampValue < Logic::Term
|
|||
self.class == other.class && @stable_id == other.stable_id
|
||||
end
|
||||
|
||||
def options
|
||||
type_de_champ.drop_down_list_enabled_non_empty_options
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def type_de_champ
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue