[#3477] Extract helper

This commit is contained in:
Frederic Merizen 2019-02-13 17:50:33 +01:00
parent 5e1dc7059a
commit 58158938cb

View file

@ -112,7 +112,7 @@ module NewGestionnaire
procedure_presentation.update(displayed_fields: fields) procedure_presentation.update(displayed_fields: fields)
current_sort = procedure_presentation.sort current_sort = procedure_presentation.sort
if !values.include?("#{current_sort['table']}/#{current_sort['column']}") if !values.include?(field_id(current_sort))
procedure_presentation.update(sort: Procedure.default_sort) procedure_presentation.update(sort: Procedure.default_sort)
end end
@ -194,6 +194,10 @@ module NewGestionnaire
private private
def field_id(field)
"#{field['table']}/#{field['column']}"
end
def statut def statut
@statut ||= (params[:statut].presence || 'a-suivre') @statut ||= (params[:statut].presence || 'a-suivre')
end end
@ -228,9 +232,7 @@ module NewGestionnaire
end end
def displayed_fields_values def displayed_fields_values
procedure_presentation.displayed_fields.map do |field| procedure_presentation.displayed_fields.map { |field| field_id(field) }
"#{field['table']}/#{field['column']}"
end
end end
def current_filters def current_filters