Merge pull request #5286 from tchak/fix-private-type-de-champ
Fix oui/non filter on type_de_champ_private
This commit is contained in:
commit
c30da86832
1 changed files with 7 additions and 4 deletions
|
@ -174,12 +174,14 @@ class ProcedurePresentation < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def human_value_for_filter(filter)
|
def human_value_for_filter(filter)
|
||||||
if filter['table'] == 'type_de_champ'
|
case filter['table']
|
||||||
|
when 'type_de_champ', 'type_de_champ_private'
|
||||||
type_de_champ = TypeDeChamp.find_by(id: filter['column'])
|
type_de_champ = TypeDeChamp.find_by(id: filter['column'])
|
||||||
return type_de_champ.dynamic_type.filter_to_human(filter['value'])
|
type_de_champ.dynamic_type.filter_to_human(filter['value'])
|
||||||
end
|
else
|
||||||
filter['value']
|
filter['value']
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def add_filter(statut, field, value)
|
def add_filter(statut, field, value)
|
||||||
if value.present?
|
if value.present?
|
||||||
|
@ -187,7 +189,8 @@ class ProcedurePresentation < ApplicationRecord
|
||||||
table, column = field.split('/')
|
table, column = field.split('/')
|
||||||
label = find_field(table, column)['label']
|
label = find_field(table, column)['label']
|
||||||
|
|
||||||
if table == 'type_de_champ'
|
case table
|
||||||
|
when 'type_de_champ', 'type_de_champ_private'
|
||||||
type_de_champ = TypeDeChamp.find_by(id: column)
|
type_de_champ = TypeDeChamp.find_by(id: column)
|
||||||
value = type_de_champ.dynamic_type.human_to_filter(value)
|
value = type_de_champ.dynamic_type.human_to_filter(value)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue