Merge pull request #10735 from demarches-simplifiees/go_bye_bye_virtual

Tech: retire l'attribut virtual des colonnes
This commit is contained in:
LeSim 2024-09-03 07:18:13 +00:00 committed by GitHub
commit 44d5704af2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 8 deletions

View file

@ -3,7 +3,7 @@
class Column class Column
attr_reader :table, :column, :label, :classname, :type, :scope, :value_column, :filterable, :displayable attr_reader :table, :column, :label, :classname, :type, :scope, :value_column, :filterable, :displayable
def initialize(table:, column:, label: nil, type: :text, value_column: :value, filterable: true, displayable: true, classname: '', scope: '', virtual: nil) def initialize(table:, column:, label: nil, type: :text, value_column: :value, filterable: true, displayable: true, classname: '', scope: '')
@table = table @table = table
@column = column @column = column
@label = label || I18n.t(column, scope: [:activerecord, :attributes, :procedure_presentation, :fields, table]) @label = label || I18n.t(column, scope: [:activerecord, :attributes, :procedure_presentation, :fields, table])
@ -13,7 +13,7 @@ class Column
@value_column = value_column @value_column = value_column
@filterable = filterable @filterable = filterable
# We need this for backward compatibility # We need this for backward compatibility
@displayable = virtual ? false : displayable @displayable = displayable
end end
def id def id

View file

@ -8,7 +8,7 @@ module AddressableColumnConcern
super.concat([ super.concat([
Columns::JSONPathColumn.new( Columns::JSONPathColumn.new(
table:, table:,
virtual: true, displayable: false,
column: stable_id, column: stable_id,
label: "#{libelle} code postal (5 chiffres)", label: "#{libelle} code postal (5 chiffres)",
type: :text, type: :text,
@ -16,7 +16,7 @@ module AddressableColumnConcern
), ),
Columns::JSONPathColumn.new( Columns::JSONPathColumn.new(
table:, table:,
virtual: true, displayable: false,
column: stable_id, column: stable_id,
label: "#{libelle} commune", label: "#{libelle} commune",
type: :text, type: :text,
@ -24,7 +24,7 @@ module AddressableColumnConcern
), ),
Columns::JSONPathColumn.new( Columns::JSONPathColumn.new(
table:, table:,
virtual: true, displayable: false,
column: stable_id, column: stable_id,
label: "#{libelle} département", label: "#{libelle} département",
type: :enum, type: :enum,
@ -32,7 +32,7 @@ module AddressableColumnConcern
), ),
Columns::JSONPathColumn.new( Columns::JSONPathColumn.new(
table:, table:,
virtual: true, displayable: false,
column: stable_id, column: stable_id,
label: "#{libelle} region", label: "#{libelle} region",
type: :enum, type: :enum,

View file

@ -22,12 +22,12 @@ module ColumnsConcern
dates = ['created_at', 'updated_at', 'depose_at', 'en_construction_at', 'en_instruction_at', 'processed_at'] dates = ['created_at', 'updated_at', 'depose_at', 'en_construction_at', 'en_instruction_at', 'processed_at']
.map { |column| Column.new(table: 'self', column:, type: :date) } .map { |column| Column.new(table: 'self', column:, type: :date) }
virtual_dates = ['updated_since', 'depose_since', 'en_construction_since', 'en_instruction_since', 'processed_since'] non_displayable_dates = ['updated_since', 'depose_since', 'en_construction_since', 'en_instruction_since', 'processed_since']
.map { |column| Column.new(table: 'self', column:, type: :date, displayable: false) } .map { |column| Column.new(table: 'self', column:, type: :date, displayable: false) }
states = [Column.new(table: 'self', column: 'state', type: :enum, scope: 'instructeurs.dossiers.filterable_state', displayable: false)] states = [Column.new(table: 'self', column: 'state', type: :enum, scope: 'instructeurs.dossiers.filterable_state', displayable: false)]
[common, dates, sva_svr_columns(for_filters: true), virtual_dates, states].flatten.compact [common, dates, sva_svr_columns(for_filters: true), non_displayable_dates, states].flatten.compact
end end
def sva_svr_columns(for_filters: false) def sva_svr_columns(for_filters: false)