[#3477] Extract all variables from sort hash
This commit is contained in:
parent
21128d94b6
commit
cf2b40f6a0
1 changed files with 2 additions and 3 deletions
|
@ -74,8 +74,7 @@ class ProcedurePresentation < ApplicationRecord
|
||||||
|
|
||||||
def sorted_ids(dossiers, gestionnaire)
|
def sorted_ids(dossiers, gestionnaire)
|
||||||
dossiers.each { |dossier| assert_matching_procedure(dossier) }
|
dossiers.each { |dossier| assert_matching_procedure(dossier) }
|
||||||
table = sort['table']
|
table, column, order = sort.values_at('table', 'column', 'order')
|
||||||
order = sort['order']
|
|
||||||
|
|
||||||
case table
|
case table
|
||||||
when 'notifications'
|
when 'notifications'
|
||||||
|
@ -90,7 +89,7 @@ class ProcedurePresentation < ApplicationRecord
|
||||||
when 'type_de_champ', 'type_de_champ_private'
|
when 'type_de_champ', 'type_de_champ_private'
|
||||||
return dossiers
|
return dossiers
|
||||||
.includes(table == 'type_de_champ' ? :champs : :champs_private)
|
.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}")
|
.order("champs.value #{order}")
|
||||||
.pluck(:id)
|
.pluck(:id)
|
||||||
when 'self', 'user', 'individual', 'etablissement'
|
when 'self', 'user', 'individual', 'etablissement'
|
||||||
|
|
Loading…
Reference in a new issue