[#3477] Prefer pluck over map
This commit is contained in:
parent
c53370e14c
commit
71f766c434
1 changed files with 2 additions and 2 deletions
|
@ -111,7 +111,7 @@ class ProcedurePresentation < ApplicationRecord
|
||||||
filters[statut].group_by { |filter| filter.slice('table', 'column') } .map do |field, filters|
|
filters[statut].group_by { |filter| filter.slice('table', 'column') } .map do |field, filters|
|
||||||
table = field['table']
|
table = field['table']
|
||||||
column = sanitized_column(field)
|
column = sanitized_column(field)
|
||||||
values = filters.map { |filter| filter['value'] }
|
values = filters.pluck('value')
|
||||||
case table
|
case table
|
||||||
when 'self'
|
when 'self'
|
||||||
dates = values.map { |v| Time.zone.parse(v).beginning_of_day rescue nil }
|
dates = values.map { |v| Time.zone.parse(v).beginning_of_day rescue nil }
|
||||||
|
@ -272,7 +272,7 @@ class ProcedurePresentation < ApplicationRecord
|
||||||
def valid_columns_for_table(table)
|
def valid_columns_for_table(table)
|
||||||
@column_whitelist ||= fields
|
@column_whitelist ||= fields
|
||||||
.group_by { |field| field['table'] }
|
.group_by { |field| field['table'] }
|
||||||
.map { |table, fields| [table, Set.new(fields.map { |field| field['column'] })] }
|
.map { |table, fields| [table, Set.new(fields.pluck('column'))] }
|
||||||
.to_h
|
.to_h
|
||||||
|
|
||||||
@column_whitelist[table] || []
|
@column_whitelist[table] || []
|
||||||
|
|
Loading…
Reference in a new issue