[#3477] Introduce column variable
This commit is contained in:
parent
35d5322a9b
commit
55d4dcc174
1 changed files with 3 additions and 3 deletions
|
@ -102,7 +102,7 @@ class ProcedurePresentation < ApplicationRecord
|
|||
def filtered_ids(dossiers, statut)
|
||||
dossiers.each { |dossier| assert_matching_procedure(dossier) }
|
||||
filters[statut].group_by { |filter| filter.slice('table', 'column') } .map do |field, filters|
|
||||
table = field['table']
|
||||
table, column = field.values_at('table', 'column')
|
||||
table_column = sanitized_column(field)
|
||||
values = filters.pluck('value')
|
||||
case table
|
||||
|
@ -116,10 +116,10 @@ class ProcedurePresentation < ApplicationRecord
|
|||
Filter.new(
|
||||
dossiers
|
||||
.includes(relation)
|
||||
.where("champs.type_de_champ_id = ?", field['column'].to_i)
|
||||
.where("champs.type_de_champ_id = ?", column.to_i)
|
||||
).where_ilike('champs.value', values)
|
||||
when 'etablissement'
|
||||
if field['column'] == 'entreprise_date_creation'
|
||||
if column == 'entreprise_date_creation'
|
||||
dates = values.map { |v| v.to_date rescue nil }
|
||||
Filter.new(
|
||||
dossiers.includes(table)
|
||||
|
|
Loading…
Reference in a new issue