[#3477] Extract helper to find field
This commit is contained in:
parent
bda41d7574
commit
822a3f7098
1 changed files with 6 additions and 6 deletions
|
@ -102,11 +102,7 @@ module NewGestionnaire
|
|||
end
|
||||
|
||||
fields = values.map do |value|
|
||||
table, column = value.split("/")
|
||||
|
||||
procedure_presentation.fields.find do |field|
|
||||
field['table'] == table && field['column'] == column
|
||||
end
|
||||
find_field(*value.split('/'))
|
||||
end
|
||||
|
||||
procedure_presentation.update(displayed_fields: fields)
|
||||
|
@ -145,7 +141,7 @@ module NewGestionnaire
|
|||
if params[:value].present?
|
||||
filters = procedure_presentation.filters
|
||||
table, column = params[:field].split('/')
|
||||
label = procedure_presentation.fields.find { |c| c['table'] == table && c['column'] == column }['label']
|
||||
label = find_field(table, column)['label']
|
||||
|
||||
filters[statut] << {
|
||||
'label' => label,
|
||||
|
@ -194,6 +190,10 @@ module NewGestionnaire
|
|||
|
||||
private
|
||||
|
||||
def find_field(table, column)
|
||||
procedure_presentation.fields.find { |c| c['table'] == table && c['column'] == column }
|
||||
end
|
||||
|
||||
def field_id(field)
|
||||
field.values_at('table', 'column').join('/')
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue