From ac4750e5e3d5bfd8762b858a9c5f38586ab4ca13 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Wed, 13 Feb 2019 18:28:33 +0100 Subject: [PATCH] [#3477] Simplify removing a filter --- app/controllers/new_gestionnaire/procedures_controller.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/controllers/new_gestionnaire/procedures_controller.rb b/app/controllers/new_gestionnaire/procedures_controller.rb index 7c25e6555..06002ac6e 100644 --- a/app/controllers/new_gestionnaire/procedures_controller.rb +++ b/app/controllers/new_gestionnaire/procedures_controller.rb @@ -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)