review(10591#discussion_r1818752344): homogenize interface for columns builders

This commit is contained in:
mfo 2024-10-28 17:07:22 +01:00 committed by simon lehericey
parent 8afe4374c7
commit d9fc48ad70
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5

View file

@ -31,24 +31,17 @@ module ColumnsConcern
end end
def chorus_columns def chorus_columns
if chorusable? && chorus_configuration.complete? ['domaine_fonctionnel', 'referentiel_prog', 'centre_de_cout']
['domaine_fonctionnel', 'referentiel_prog', 'centre_de_cout'] .map { |column| Column.new(procedure_id: id, table: 'procedure', column:, displayable: false, filterable: false) }
.map { |column| Column.new(procedure_id: id, table: 'procedure', column:, displayable: false, filterable: false) }
else
[]
end
end end
def all_usager_columns_for_export def all_usager_columns_for_export
common = [ columns = [dossier_id_column, email_for_display_column, france_connected_column]
dossier_id_column, columns.concat(individual_columns) if for_individual
email_for_display_column, columns.concat(moral_columns) if !for_individual
france_connected_column columns.concat(chorus_columns) if chorusable? && chorus_configuration.complete?
]
individual_or_moral_columns = for_individual? ? individual_columns : moral_columns columns.flatten.compact
[common, individual_or_moral_columns, chorus_columns].flatten.compact
end end
def all_dossier_columns_for_export def all_dossier_columns_for_export