From cf2b40f6a0dbc5243d63516c2edd78fb93037f1b Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Tue, 26 Feb 2019 16:08:35 +0100 Subject: [PATCH] [#3477] Extract all variables from sort hash --- app/models/procedure_presentation.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/models/procedure_presentation.rb b/app/models/procedure_presentation.rb index 4a9e5935e..7a3ba2f67 100644 --- a/app/models/procedure_presentation.rb +++ b/app/models/procedure_presentation.rb @@ -74,8 +74,7 @@ class ProcedurePresentation < ApplicationRecord def sorted_ids(dossiers, gestionnaire) dossiers.each { |dossier| assert_matching_procedure(dossier) } - table = sort['table'] - order = sort['order'] + table, column, order = sort.values_at('table', 'column', 'order') case table when 'notifications' @@ -90,7 +89,7 @@ class ProcedurePresentation < ApplicationRecord when 'type_de_champ', 'type_de_champ_private' return dossiers .includes(table == 'type_de_champ' ? :champs : :champs_private) - .where("champs.type_de_champ_id = #{sort['column'].to_i}") + .where("champs.type_de_champ_id = #{column.to_i}") .order("champs.value #{order}") .pluck(:id) when 'self', 'user', 'individual', 'etablissement'