[#3477] Simplify removing a filter

This commit is contained in:
Frederic Merizen 2019-02-13 18:28:33 +01:00
parent 822a3f7098
commit ac4750e5e3

View file

@ -158,11 +158,9 @@ module NewGestionnaire
def remove_filter
filters = procedure_presentation.filters
filter_to_remove = current_filters.find do |filter|
filter['table'] == params[:table] && filter['column'] == params[:column]
end
filters[statut] = filters[statut] - [filter_to_remove]
to_remove = params.values_at(:table, :column)
filters[statut].reject! { |filter| filter.values_at('table', 'column') == to_remove }
procedure_presentation.update(filters: filters)