small refactors
This commit is contained in:
parent
772424ff5e
commit
7a1c25271d
2 changed files with 6 additions and 5 deletions
|
@ -1,4 +1,6 @@
|
|||
class Facet
|
||||
attr_reader :table, :column, :label, :classname, :virtual, :type, :scope, :value_column, :filterable
|
||||
|
||||
TYPE_DE_CHAMP = 'type_de_champ'
|
||||
|
||||
def initialize(table:, column:, label: nil, virtual: false, type: :text, value_column: :value, filterable: true, classname: '', scope: '')
|
||||
|
@ -13,7 +15,9 @@ class Facet
|
|||
@filterable = filterable
|
||||
end
|
||||
|
||||
attr_reader :table, :column, :label, :classname, :virtual, :type, :scope, :value_column, :filterable
|
||||
def id
|
||||
"#{table}/#{column}"
|
||||
end
|
||||
|
||||
def ==(other)
|
||||
other.to_json == to_json
|
||||
|
|
|
@ -236,10 +236,7 @@ class ProcedurePresentation < ApplicationRecord
|
|||
end
|
||||
|
||||
def update_displayed_fields(facet_ids)
|
||||
if facet_ids.nil?
|
||||
facet_ids = []
|
||||
end
|
||||
|
||||
facet_ids = Array.wrap(facet_ids)
|
||||
facets = facet_ids.map { |id| Facet.find(procedure:, id:) }
|
||||
|
||||
update!(displayed_fields: facets)
|
||||
|
|
Loading…
Reference in a new issue