review(pull/10591#discussion_r1818914395): extract and dry archived/motivation column
This commit is contained in:
parent
d9fc48ad70
commit
fc45e537cf
1 changed files with 6 additions and 11 deletions
|
@ -47,10 +47,6 @@ module ColumnsConcern
|
||||||
def all_dossier_columns_for_export
|
def all_dossier_columns_for_export
|
||||||
states = [dossier_state_column]
|
states = [dossier_state_column]
|
||||||
|
|
||||||
for_export_before_date = ['archived']
|
|
||||||
.map { |column| Column.new(procedure_id: id, table: 'self', column:, type: :text, displayable: false, filterable: false) }
|
|
||||||
for_export_after_date = ['motivation']
|
|
||||||
.map { |column| Column.new(procedure_id: id, table: 'self', column:, type: :text, displayable: false, filterable: false) }
|
|
||||||
routing =
|
routing =
|
||||||
if self.routing_enabled?
|
if self.routing_enabled?
|
||||||
[Column.new(procedure_id: id, table: 'groupe_instructeur', column: 'id')]
|
[Column.new(procedure_id: id, table: 'groupe_instructeur', column: 'id')]
|
||||||
|
@ -60,7 +56,7 @@ module ColumnsConcern
|
||||||
|
|
||||||
instructeurs = [Column.new(procedure_id: id, table: 'followers_instructeurs', column: 'email')]
|
instructeurs = [Column.new(procedure_id: id, table: 'followers_instructeurs', column: 'email')]
|
||||||
|
|
||||||
[states, for_export_before_date, dossier_dates_columns, for_export_after_date, sva_svr_columns(for_export: true), routing, instructeurs].flatten.compact
|
[states, dossier_archived_column, dossier_dates_columns, dossier_motivation_column, sva_svr_columns(for_export: true), routing, instructeurs].flatten.compact
|
||||||
end
|
end
|
||||||
|
|
||||||
def dossier_id_column
|
def dossier_id_column
|
||||||
|
@ -87,12 +83,7 @@ module ColumnsConcern
|
||||||
non_displayable_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(procedure_id: id, table: 'self', column:, type: :date, displayable: false) }
|
.map { |column| Column.new(procedure_id: id, table: 'self', column:, type: :date, displayable: false) }
|
||||||
|
|
||||||
for_export_before_date = ['archived']
|
[common, states, dossier_archived_column, dossier_dates_columns, dossier_motivation_column, sva_svr_columns(for_export: false), non_displayable_dates].flatten.compact
|
||||||
.map { |column| Column.new(procedure_id: id, table: 'self', column:, type: :text, displayable: false, filterable: false) }
|
|
||||||
for_export_after_date = ['motivation']
|
|
||||||
.map { |column| Column.new(procedure_id: id, table: 'self', column:, type: :text, displayable: false, filterable: false) }
|
|
||||||
|
|
||||||
[common, states, for_export_before_date, dossier_dates_columns, for_export_after_date, sva_svr_columns(for_export: false), non_displayable_dates].flatten.compact
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def dossier_dates_columns
|
def dossier_dates_columns
|
||||||
|
@ -122,6 +113,10 @@ module ColumnsConcern
|
||||||
|
|
||||||
def default_displayed_columns = [email_column]
|
def default_displayed_columns = [email_column]
|
||||||
|
|
||||||
|
def dossier_archived_column = Column.new(procedure_id: id, table: 'self', column: 'archived', type: :text, displayable: false, filterable: false);
|
||||||
|
|
||||||
|
def dossier_motivation_column = Column.new(procedure_id: id, table: 'self', column: 'motivation', type: :text, displayable: false, filterable: false);
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def email_column
|
def email_column
|
||||||
|
|
Loading…
Reference in a new issue