human_value use stable_id ?

This commit is contained in:
simon lehericey 2020-10-30 15:07:24 +01:00 committed by Paul Chavard
parent 4960eda5cb
commit 024cc70667

View file

@ -192,8 +192,7 @@ class ProcedurePresentation < ApplicationRecord
def human_value_for_filter(filter)
case filter['table']
when 'type_de_champ', 'type_de_champ_private'
type_de_champ = TypeDeChamp.find_by(id: filter['column'])
type_de_champ.dynamic_type.filter_to_human(filter['value'])
find_type_de_champ(filter['column']).dynamic_type.filter_to_human(filter['value'])
else
filter['value']
end
@ -270,6 +269,10 @@ class ProcedurePresentation < ApplicationRecord
fields.find { |field| field.values_at('table', 'column') == [table, column] }
end
def find_type_de_champ(column)
TypeDeChamp.order(:revision_id).find_by(stable_id: column)
end
def check_allowed_displayed_fields
displayed_fields.each do |field|
check_allowed_field(:displayed_fields, field)