add filtered_column type

This commit is contained in:
simon lehericey 2024-09-27 12:50:57 +02:00
parent 4e0d3c2df1
commit d54ab64e40
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
6 changed files with 130 additions and 10 deletions

View file

@ -0,0 +1,12 @@
# frozen_string_literal: true
class FilteredColumn
def initialize(column:, filter:)
@column = column
@filter = filter
end
def ==(other)
other&.column == column && other.filter == filter
end
end

View file

@ -25,14 +25,14 @@ class ProcedurePresentation < ApplicationRecord
attribute :sorted_column, :sorted_column
def sorted_column = super || procedure.default_sorted_column # Dummy override to set default value
attribute :a_suivre_filters, :jsonb, array: true
attribute :suivis_filters, :jsonb, array: true
attribute :traites_filters, :jsonb, array: true
attribute :tous_filters, :jsonb, array: true
attribute :supprimes_filters, :jsonb, array: true
attribute :supprimes_recemment_filters, :jsonb, array: true
attribute :expirant_filters, :jsonb, array: true
attribute :archives_filters, :jsonb, array: true
attribute :a_suivre_filters, :filtered_column, array: true
attribute :suivis_filters, :filtered_column, array: true
attribute :traites_filters, :filtered_column, array: true
attribute :tous_filters, :filtered_column, array: true
attribute :supprimes_filters, :filtered_column, array: true
attribute :supprimes_recemment_filters, :filtered_column, array: true
attribute :expirant_filters, :filtered_column, array: true
attribute :archives_filters, :filtered_column, array: true
def filters_for(statut)
send(filters_name_for(statut))