Merge pull request #10992 from demarches-simplifiees/align-column-naming-and-prepare-columns-for-export
WIP – tech: ETQ instructeur, amélioration du nommage des colonnes pour les filtres/display/export. préparation du nommage des colonnes a exporter
This commit is contained in:
commit
11d4465bf5
12 changed files with 352 additions and 105 deletions
|
@ -25,49 +25,49 @@ module ColumnsConcern
|
|||
columns.concat(standard_columns)
|
||||
columns.concat(individual_columns) if for_individual
|
||||
columns.concat(moral_columns) if !for_individual
|
||||
columns.concat(procedure_chorus_columns) if chorusable? && chorus_configuration.complete?
|
||||
columns.concat(types_de_champ_columns)
|
||||
end
|
||||
end
|
||||
|
||||
def dossier_id_column
|
||||
Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'id', type: :number)
|
||||
def usager_columns_for_export
|
||||
columns = [dossier_id_column, user_email_for_display_column, user_france_connected_column]
|
||||
columns.concat(individual_columns) if for_individual
|
||||
columns.concat(moral_columns) if !for_individual
|
||||
columns.concat(procedure_chorus_columns) if chorusable? && chorus_configuration.complete?
|
||||
|
||||
# ensure the columns exist in main list
|
||||
columns.filter { _1.id.in?(self.columns.map(&:id)) }
|
||||
end
|
||||
|
||||
def dossier_state_column
|
||||
Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'state', type: :enum, scope: 'instructeurs.dossiers.filterable_state', displayable: false)
|
||||
def dossier_columns_for_export
|
||||
columns = [dossier_state_column, dossier_archived_column]
|
||||
columns.concat(dossier_dates_columns)
|
||||
columns.concat([dossier_motivation_column])
|
||||
columns.concat(sva_svr_columns(for_export: true)) if sva_svr_enabled?
|
||||
columns.concat([groupe_instructeurs_id_column, followers_instructeurs_email_column])
|
||||
|
||||
# ensure the columns exist in main list
|
||||
columns.filter { _1.id.in?(self.columns.map(&:id)) }
|
||||
end
|
||||
|
||||
def notifications_column
|
||||
Columns::DossierColumn.new(procedure_id: id, table: 'notifications', column: 'notifications', label: "notifications", filterable: false)
|
||||
end
|
||||
def dossier_id_column = Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'id', type: :number)
|
||||
|
||||
def dossier_columns
|
||||
common = [dossier_id_column, notifications_column]
|
||||
def dossier_state_column = Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'state', type: :enum, scope: 'instructeurs.dossiers.filterable_state', displayable: false)
|
||||
|
||||
dates = ['created_at', 'updated_at', 'depose_at', 'en_construction_at', 'en_instruction_at', 'processed_at']
|
||||
.map { |column| Columns::DossierColumn.new(procedure_id: id, table: 'self', column:, type: :date) }
|
||||
|
||||
non_displayable_dates = ['updated_since', 'depose_since', 'en_construction_since', 'en_instruction_since', 'processed_since']
|
||||
.map { |column| Columns::DossierColumn.new(procedure_id: id, table: 'self', column:, type: :date, displayable: false) }
|
||||
|
||||
states = [dossier_state_column]
|
||||
|
||||
[common, dates, sva_svr_columns, non_displayable_dates, states].flatten.compact
|
||||
end
|
||||
|
||||
def sva_svr_columns
|
||||
return if !sva_svr_enabled?
|
||||
def notifications_column = Columns::DossierColumn.new(procedure_id: id, table: 'notifications', column: 'notifications', label: "notifications", filterable: false)
|
||||
|
||||
def sva_svr_columns(for_export: false)
|
||||
scope = [:activerecord, :attributes, :procedure_presentation, :fields, :self]
|
||||
|
||||
columns = [
|
||||
Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'sva_svr_decision_on', type: :date,
|
||||
label: I18n.t("#{sva_svr_decision}_decision_on", scope:))
|
||||
label: I18n.t("#{sva_svr_decision}_decision_on", scope:, type: sva_svr_configuration.human_decision))
|
||||
]
|
||||
|
||||
if !for_export
|
||||
columns << Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'sva_svr_decision_before', type: :date, displayable: false,
|
||||
label: I18n.t("#{sva_svr_decision}_decision_before", scope:))
|
||||
|
||||
end
|
||||
columns
|
||||
end
|
||||
|
||||
|
@ -79,32 +79,75 @@ module ColumnsConcern
|
|||
|
||||
private
|
||||
|
||||
def groupe_instructeurs_id_column = Columns::DossierColumn.new(procedure_id: id, table: 'groupe_instructeur', column: 'id', type: :enum)
|
||||
|
||||
def followers_instructeurs_email_column = Columns::DossierColumn.new(procedure_id: id, table: 'followers_instructeurs', column: 'email')
|
||||
|
||||
def dossier_archived_column = Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'archived', type: :text, displayable: false, filterable: false);
|
||||
|
||||
def dossier_motivation_column = Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'motivation', type: :text, displayable: false, filterable: false);
|
||||
|
||||
def user_email_for_display_column = Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'user_email_for_display', filterable: false, displayable: false)
|
||||
|
||||
def user_france_connected_column = Columns::DossierColumn.new(procedure_id: id, table: 'self', column: 'user_from_france_connect?', filterable: false, displayable: false)
|
||||
|
||||
def procedure_chorus_columns
|
||||
['domaine_fonctionnel', 'referentiel_prog', 'centre_de_cout']
|
||||
.map { |column| Columns::DossierColumn.new(procedure_id: id, table: 'procedure', column:, displayable: false, filterable: false) }
|
||||
end
|
||||
|
||||
def dossier_non_displayable_dates_columns
|
||||
['updated_since', 'depose_since', 'en_construction_since', 'en_instruction_since', 'processed_since']
|
||||
.map { |column| Columns::DossierColumn.new(procedure_id: id, table: 'self', column:, type: :date, displayable: false) }
|
||||
end
|
||||
|
||||
def dossier_dates_columns
|
||||
['created_at', 'updated_at', 'last_champ_updated_at', 'depose_at', 'en_construction_at', 'en_instruction_at', 'processed_at']
|
||||
.map { |column| Columns::DossierColumn.new(procedure_id: id, table: 'self', column:, type: :date) }
|
||||
end
|
||||
|
||||
def email_column
|
||||
Columns::DossierColumn.new(procedure_id: id, table: 'user', column: 'email')
|
||||
end
|
||||
|
||||
def dossier_columns
|
||||
columns = [dossier_id_column, notifications_column]
|
||||
columns.concat([dossier_state_column])
|
||||
columns.concat([dossier_archived_column])
|
||||
columns.concat(dossier_dates_columns)
|
||||
columns.concat([dossier_motivation_column])
|
||||
columns.concat(sva_svr_columns(for_export: false)) if sva_svr_enabled?
|
||||
columns.concat(dossier_non_displayable_dates_columns)
|
||||
end
|
||||
|
||||
def standard_columns
|
||||
[
|
||||
email_column,
|
||||
Columns::DossierColumn.new(procedure_id: id, table: 'followers_instructeurs', column: 'email'),
|
||||
Columns::DossierColumn.new(procedure_id: id, table: 'groupe_instructeur', column: 'id', type: :enum),
|
||||
Columns::DossierColumn.new(procedure_id: id, table: 'avis', column: 'question_answer', filterable: false) # not filterable ?
|
||||
user_email_for_display_column,
|
||||
followers_instructeurs_email_column,
|
||||
groupe_instructeurs_id_column,
|
||||
Columns::DossierColumn.new(procedure_id: id, table: 'avis', column: 'question_answer', filterable: false),
|
||||
user_france_connected_column
|
||||
]
|
||||
end
|
||||
|
||||
def individual_columns
|
||||
['nom', 'prenom', 'gender'].map { |column| Columns::DossierColumn.new(procedure_id: id, table: 'individual', column:) }
|
||||
['gender', 'nom', 'prenom'].map { |column| Columns::DossierColumn.new(procedure_id: id, table: 'individual', column:) }
|
||||
.concat ['for_tiers', 'mandataire_last_name', 'mandataire_first_name'].map { |column| Columns::DossierColumn.new(procedure_id: id, table: 'self', column:) }
|
||||
end
|
||||
|
||||
def moral_columns
|
||||
etablissements = ['entreprise_siren', 'entreprise_forme_juridique', 'entreprise_nom_commercial', 'entreprise_raison_sociale', 'entreprise_siret_siege_social']
|
||||
etablissements = ['entreprise_forme_juridique', 'entreprise_siren', 'entreprise_nom_commercial', 'entreprise_raison_sociale', 'entreprise_siret_siege_social']
|
||||
.map { |column| Columns::DossierColumn.new(procedure_id: id, table: 'etablissement', column:) }
|
||||
|
||||
etablissement_dates = ['entreprise_date_creation'].map { |column| Columns::DossierColumn.new(procedure_id: id, table: 'etablissement', column:, type: :date) }
|
||||
|
||||
for_export = ["siege_social", "naf", "adresse", "numero_voie", "type_voie", "nom_voie", "complement_adresse", "localite", "code_insee_localite", "entreprise_siren", "entreprise_capital_social", "entreprise_numero_tva_intracommunautaire", "entreprise_forme_juridique_code", "entreprise_code_effectif_entreprise", "entreprise_etat_administratif", "entreprise_nom", "entreprise_prenom", "association_rna", "association_titre", "association_objet", "association_date_creation", "association_date_declaration", "association_date_publication"]
|
||||
.map { |column| Columns::DossierColumn.new(procedure_id: id, table: 'etablissement', column:, displayable: false, filterable: false) }
|
||||
|
||||
other = ['siret', 'libelle_naf', 'code_postal'].map { |column| Columns::DossierColumn.new(procedure_id: id, table: 'etablissement', column:) }
|
||||
|
||||
[etablissements, etablissement_dates, other].flatten
|
||||
[etablissements, etablissement_dates, other, for_export].flatten
|
||||
end
|
||||
|
||||
def types_de_champ_columns
|
||||
|
|
|
@ -450,6 +450,10 @@ class Dossier < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def user_email_for_display
|
||||
user_email_for(:display)
|
||||
end
|
||||
|
||||
def expiration_started?
|
||||
[
|
||||
brouillon_close_to_expiration_notice_sent_at,
|
||||
|
|
|
@ -34,12 +34,13 @@ class ProcedurePresentation < ApplicationRecord
|
|||
def filters_name_for(statut) = statut.tr('-', '_').then { "#{_1}_filters" }
|
||||
|
||||
def displayed_fields_for_headers
|
||||
[
|
||||
columns = [
|
||||
procedure.dossier_id_column,
|
||||
*displayed_columns,
|
||||
procedure.dossier_state_column,
|
||||
*procedure.sva_svr_columns
|
||||
procedure.dossier_state_column
|
||||
]
|
||||
columns.concat(procedure.sva_svr_columns) if procedure.sva_svr_enabled?
|
||||
columns
|
||||
end
|
||||
|
||||
def human_value_for_filter(filtered_column)
|
||||
|
|
|
@ -5,24 +5,34 @@ en:
|
|||
fields:
|
||||
self:
|
||||
id: File Nº
|
||||
user_email_for_display: Email
|
||||
state: State
|
||||
created_at: Created on
|
||||
updated_at: Updated on
|
||||
depose_at: First submission on
|
||||
en_construction_at: Submitted on
|
||||
en_instruction_at: En instruction on
|
||||
en_instruction_at: Instructed on
|
||||
processed_at: Done on
|
||||
depose_since: First Submission since
|
||||
updated_since: Updated since
|
||||
en_construction_since: Submitted since
|
||||
en_instruction_since: Instructed since
|
||||
processed_since: Finished since
|
||||
sva_decision_on: SVA decision date
|
||||
sva_decision_on: Date décision %{type}
|
||||
sva_decision_before: SVA decision date before
|
||||
svr_decision_on: SVR decision date
|
||||
svr_decision_on: Date décision %{type}
|
||||
svr_decision_before: SVR decision date before
|
||||
user_from_france_connect?: "France connecté ?"
|
||||
for_tiers: "For tiers"
|
||||
mandataire_last_name: "Tier last name"
|
||||
mandataire_first_name: "Tier first name"
|
||||
user:
|
||||
id: User Id
|
||||
email: Requester
|
||||
procedure:
|
||||
domaine_fonctionnel: Domaine Fonctionnel
|
||||
referentiel_prog: Référentiel De Programmation
|
||||
centre_de_cout: Centre De Coût
|
||||
followers_instructeurs:
|
||||
email: Email instructeur
|
||||
groupe_instructeur:
|
||||
|
@ -36,12 +46,38 @@ en:
|
|||
answer: Opinion
|
||||
question_answer: Opinion yes/no
|
||||
etablissement:
|
||||
entreprise_siren: SIREN
|
||||
entreprise_etat_administratif: 'Entreprise état administratif'
|
||||
entreprise_forme_juridique: Forme juridique
|
||||
entreprise_nom_commercial: Commercial name
|
||||
entreprise_raison_sociale: Raison sociale
|
||||
entreprise_siret_siege_social: SIRET siège social
|
||||
entreprise_date_creation: Creation date
|
||||
siret: SIRET
|
||||
entreprise_date_creation: Entreprise date de création
|
||||
siret: Établissement SIRET
|
||||
libelle_naf: Libellé NAF
|
||||
code_postal: Postal code
|
||||
siege_social: "Établissement siège social"
|
||||
naf: "Établissement NAF"
|
||||
adresse: "Établissement Adresse"
|
||||
numero_voie: "Établissement numero voie"
|
||||
type_voie: "Établissement type voie"
|
||||
nom_voie: "Établissement nom voie"
|
||||
complement_adresse: "Établissement complément adresse"
|
||||
code_postal: "Établissement code postal"
|
||||
localite: "Établissement localité"
|
||||
code_insee_localite: "Établissement code INSEE localité"
|
||||
entreprise_siren: SIREN
|
||||
entreprise_capital_social: "Entreprise capital social"
|
||||
entreprise_numero_tva_intracommunautaire: "Entreprise numero TVA intracommunautaire"
|
||||
entreprise_forme_juridique: "Entreprise forme juridique"
|
||||
entreprise_forme_juridique_code: "Entreprise forme juridique code"
|
||||
entreprise_nom_commercial: "Entreprise nom commercial"
|
||||
entreprise_raison_sociale: "Entreprise raison sociale"
|
||||
entreprise_siret_siege_social: "Entreprise SIRET siège social"
|
||||
entreprise_code_effectif_entreprise: "Entreprise code effectif entreprise"
|
||||
entreprise_nom: 'Entreprise nom'
|
||||
entreprise_prenom: 'Entreprise prénom'
|
||||
association_rna: 'Association RNA'
|
||||
association_titre: 'Association titre'
|
||||
association_objet: 'Association objet'
|
||||
association_date_creation: 'Association date de création'
|
||||
association_date_declaration: 'Association date de déclaration'
|
||||
association_date_publication: 'Association date de publication'
|
||||
|
|
|
@ -5,26 +5,40 @@ fr:
|
|||
fields:
|
||||
self:
|
||||
id: Nº dossier
|
||||
state: Statut
|
||||
created_at: Créé le
|
||||
updated_at: Mis à jour le
|
||||
depose_at: Déposé le
|
||||
en_construction_at: En construction le
|
||||
en_instruction_at: En instruction le
|
||||
processed_at: Terminé le
|
||||
updated_since: Mis à jour depuis
|
||||
user_email_for_display: Email
|
||||
state: État du dossier
|
||||
created_at: Date de création
|
||||
updated_at: Date du dernier évènement
|
||||
depose_at: Date de dépot
|
||||
en_construction_at: Date de passage en construction
|
||||
en_instruction_at: Date de passage en instruction
|
||||
processed_at: Date de traitement
|
||||
updated_since: Dernier évènement depuis
|
||||
depose_since: Déposé depuis
|
||||
en_construction_since: En construction depuis
|
||||
en_instruction_since: En instruction depuis
|
||||
processed_since: Terminé depuis
|
||||
sva_decision_on: Date décision SVA
|
||||
processed_since: Traité depuis
|
||||
sva_decision_on: Date décision %{type}
|
||||
sva_decision_before: Date décision SVA avant
|
||||
svr_decision_on: Date décision SVR
|
||||
svr_decision_on: Date décision %{type}
|
||||
svr_decision_before: Date décision SVR avant
|
||||
user_from_france_connect?: "France connecté ?"
|
||||
for_tiers: "Dépôt pour un tiers"
|
||||
mandataire_last_name: "Nom du mandataire"
|
||||
mandataire_first_name: "Prénom du mandataire"
|
||||
archived: 'Archivé'
|
||||
dossier_state: 'État du dossier'
|
||||
last_champ_updated_at: Date de dernière modification (usager)
|
||||
motivation: 'Motivation de la décision'
|
||||
user:
|
||||
id: Identifiant du demandeur
|
||||
email: Demandeur
|
||||
procedure:
|
||||
domaine_fonctionnel: Domaine Fonctionnel
|
||||
referentiel_prog: Référentiel De Programmation
|
||||
centre_de_cout: Centre De Coût
|
||||
followers_instructeurs:
|
||||
email: Email instructeur
|
||||
email: Instructeurs
|
||||
groupe_instructeur:
|
||||
id: Groupe instructeur
|
||||
label: Groupe instructeur
|
||||
|
@ -36,12 +50,38 @@ fr:
|
|||
answer: Avis
|
||||
question_answer: Avis oui/non
|
||||
etablissement:
|
||||
entreprise_siren: SIREN
|
||||
entreprise_etat_administratif: 'Entreprise état administratif'
|
||||
entreprise_forme_juridique: Forme juridique
|
||||
entreprise_nom_commercial: Nom commercial
|
||||
entreprise_raison_sociale: Raison sociale
|
||||
entreprise_siret_siege_social: SIRET siège social
|
||||
entreprise_date_creation: Date de création
|
||||
siret: SIRET
|
||||
entreprise_date_creation: Entreprise date de création
|
||||
siret: Établissement SIRET
|
||||
libelle_naf: Libellé NAF
|
||||
code_postal: Code postal
|
||||
siege_social: "Établissement siège social"
|
||||
naf: "Établissement NAF"
|
||||
adresse: "Établissement Adresse"
|
||||
numero_voie: "Établissement numero voie"
|
||||
type_voie: "Établissement type voie"
|
||||
nom_voie: "Établissement nom voie"
|
||||
complement_adresse: "Établissement complément adresse"
|
||||
code_postal: "Établissement code postal"
|
||||
localite: "Établissement localité"
|
||||
code_insee_localite: "Établissement code INSEE localité"
|
||||
entreprise_siren: "Entreprise SIREN"
|
||||
entreprise_capital_social: "Entreprise capital social"
|
||||
entreprise_numero_tva_intracommunautaire: "Entreprise numero TVA intracommunautaire"
|
||||
entreprise_forme_juridique: "Entreprise forme juridique"
|
||||
entreprise_forme_juridique_code: "Entreprise forme juridique code"
|
||||
entreprise_nom_commercial: "Entreprise nom commercial"
|
||||
entreprise_raison_sociale: "Entreprise raison sociale"
|
||||
entreprise_siret_siege_social: "Entreprise SIRET siège social"
|
||||
entreprise_code_effectif_entreprise: "Entreprise code effectif entreprise"
|
||||
entreprise_nom: 'Entreprise nom'
|
||||
entreprise_prenom: 'Entreprise prénom'
|
||||
association_rna: 'Association RNA'
|
||||
association_titre: 'Association titre'
|
||||
association_objet: 'Association objet'
|
||||
association_date_creation: 'Association date de création'
|
||||
association_date_declaration: 'Association date de déclaration'
|
||||
association_date_publication: 'Association date de publication'
|
||||
|
|
|
@ -38,7 +38,7 @@ describe '20240920130741_migrate_procedure_presentation_to_columns.rake' do
|
|||
it 'populates the columns' do
|
||||
procedure_id = procedure.id
|
||||
|
||||
expect(procedure_presentation.displayed_columns.map(&:label)).to eq(["Raison sociale", procedure.active_revision.types_de_champ.first.libelle])
|
||||
expect(procedure_presentation.displayed_columns.map(&:label)).to eq(["Entreprise raison sociale", procedure.active_revision.types_de_champ.first.libelle])
|
||||
|
||||
order, column_id = procedure_presentation
|
||||
.sorted_column
|
||||
|
|
|
@ -29,24 +29,28 @@ describe ColumnsConcern do
|
|||
let(:tdc_private_2) { procedure.active_revision.types_de_champ_private[1] }
|
||||
let(:expected) {
|
||||
[
|
||||
{ label: 'Nº dossier', table: 'self', column: 'id', displayable: true, type: :number, scope: '', value_column: :value, filterable: true },
|
||||
{ label: 'Dossier ID', table: 'self', column: 'id', displayable: true, type: :number, scope: '', value_column: :value, filterable: true },
|
||||
{ label: 'notifications', table: 'notifications', column: 'notifications', displayable: true, type: :text, scope: '', value_column: :value, filterable: false },
|
||||
{ label: 'Créé le', table: 'self', column: 'created_at', displayable: true, type: :date, scope: '', value_column: :value, filterable: true },
|
||||
{ label: 'Date de création', table: 'self', column: 'created_at', displayable: true, type: :date, scope: '', value_column: :value, filterable: true },
|
||||
{ label: 'Mis à jour le', table: 'self', column: 'updated_at', displayable: true, type: :date, scope: '', value_column: :value, filterable: true },
|
||||
{ label: 'Déposé le', table: 'self', column: 'depose_at', displayable: true, type: :date, scope: '', value_column: :value, filterable: true },
|
||||
{ label: 'Date de dépot', table: 'self', column: 'depose_at', displayable: true, type: :date, scope: '', value_column: :value, filterable: true },
|
||||
{ label: 'En construction le', table: 'self', column: 'en_construction_at', displayable: true, type: :date, scope: '', value_column: :value, filterable: true },
|
||||
{ label: 'En instruction le', table: 'self', column: 'en_instruction_at', displayable: true, type: :date, scope: '', value_column: :value, filterable: true },
|
||||
{ label: 'Terminé le', table: 'self', column: 'processed_at', displayable: true, type: :date, scope: '', value_column: :value, filterable: true },
|
||||
{ label: "Mis à jour depuis", table: "self", column: "updated_since", displayable: false, type: :date, scope: '', value_column: :value, filterable: true },
|
||||
{ label: "Dernier évènement depuis", table: "self", column: "updated_since", displayable: false, type: :date, scope: '', value_column: :value, filterable: true },
|
||||
{ label: "Déposé depuis", table: "self", column: "depose_since", displayable: false, type: :date, scope: '', value_column: :value, filterable: true },
|
||||
{ label: "En construction depuis", table: "self", column: "en_construction_since", displayable: false, type: :date, scope: '', value_column: :value, filterable: true },
|
||||
{ label: "En instruction depuis", table: "self", column: "en_instruction_since", displayable: false, type: :date, scope: '', value_column: :value, filterable: true },
|
||||
{ label: "Terminé depuis", table: "self", column: "processed_since", displayable: false, type: :date, scope: '', value_column: :value, filterable: true },
|
||||
{ label: "Traité depuis", table: "self", column: "processed_since", displayable: false, type: :date, scope: '', value_column: :value, filterable: true },
|
||||
{ label: "Statut", table: "self", column: "state", displayable: false, scope: 'instructeurs.dossiers.filterable_state', type: :enum, value_column: :value, filterable: true },
|
||||
{ label: "Archivé", table: "self", column: "archived", displayable: false, scope: '', type: :text, value_column: :value, filterable: false },
|
||||
{ label: "Motivation de la décision", table: "self", column: "motivation", displayable: false, scope: '', type: :text, value_column: :value, filterable: false },
|
||||
{ label: "Date de dernière modification (usager)", table: "self", column: "last_champ_updated_at", displayable: false, scope: '', type: :text, value_column: :value, filterable: false },
|
||||
{ label: 'Demandeur', table: 'user', column: 'email', displayable: true, type: :text, scope: '', value_column: :value, filterable: true },
|
||||
{ label: 'Email instructeur', table: 'followers_instructeurs', column: 'email', displayable: true, type: :text, scope: '', value_column: :value, filterable: true },
|
||||
{ label: 'Groupe instructeur', table: 'groupe_instructeur', column: 'id', displayable: true, type: :enum, scope: '', value_column: :value, filterable: true },
|
||||
{ label: 'Avis oui/non', table: 'avis', column: 'question_answer', displayable: true, type: :text, scope: '', value_column: :value, filterable: false },
|
||||
{ label: 'France connecté ?', table: 'self', column: 'user_from_france_connect?', displayable: false, type: :text, scope: '', value_column: :value, filterable: false },
|
||||
{ label: 'SIREN', table: 'etablissement', column: 'entreprise_siren', displayable: true, type: :text, scope: '', value_column: :value, filterable: true },
|
||||
{ label: 'Forme juridique', table: 'etablissement', column: 'entreprise_forme_juridique', displayable: true, type: :text, scope: '', value_column: :value, filterable: true },
|
||||
{ label: 'Nom commercial', table: 'etablissement', column: 'entreprise_nom_commercial', displayable: true, type: :text, scope: '', value_column: :value, filterable: true },
|
||||
|
@ -73,7 +77,11 @@ describe ColumnsConcern do
|
|||
procedure.active_revision.types_de_champ_private[3].update_attribute(:type_champ, TypeDeChamp.type_champs.fetch(:explication))
|
||||
end
|
||||
|
||||
it { expect(subject).to eq(expected) }
|
||||
it {
|
||||
expected.each do |expected|
|
||||
expect(subject).to include(expected)
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
context 'with rna' do
|
||||
|
@ -125,4 +133,119 @@ describe ColumnsConcern do
|
|||
it { is_expected.to include(decision_on, decision_before_field) }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'export' do
|
||||
let(:procedure) { create(:procedure_with_dossiers, :published, types_de_champ_public:, for_individual:) }
|
||||
let(:for_individual) { true }
|
||||
let(:types_de_champ_public) do
|
||||
[
|
||||
{ type: :text, libelle: "Ca va ?", mandatory: true, stable_id: 1 },
|
||||
{ type: :communes, libelle: "Commune", mandatory: true, stable_id: 17 },
|
||||
{ type: :siret, libelle: 'siret', stable_id: 20 },
|
||||
{ type: :repetition, mandatory: true, stable_id: 7, libelle: "Champ répétable", children: [{ type: 'text', libelle: 'Qqchose à rajouter?', stable_id: 8 }] }
|
||||
]
|
||||
end
|
||||
|
||||
describe '#usager_columns_for_export' do
|
||||
context 'for individual procedure' do
|
||||
let(:for_individual) { true }
|
||||
|
||||
it "returns all usager columns" do
|
||||
expected = [
|
||||
procedure.find_column(label: "Nº dossier"),
|
||||
procedure.find_column(label: "Email"),
|
||||
procedure.find_column(label: "France connecté ?"),
|
||||
procedure.find_column(label: "Civilité"),
|
||||
procedure.find_column(label: "Nom"),
|
||||
procedure.find_column(label: "Prénom"),
|
||||
procedure.find_column(label: "Dépôt pour un tiers"),
|
||||
procedure.find_column(label: "Nom du mandataire"),
|
||||
procedure.find_column(label: "Prénom du mandataire")
|
||||
]
|
||||
actuals = procedure.usager_columns_for_export.map(&:h_id)
|
||||
expected.each do |expected_col|
|
||||
expect(actuals).to include(expected_col.h_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'for entreprise procedure' do
|
||||
let(:for_individual) { false }
|
||||
|
||||
it "returns all usager columns" do
|
||||
expected = [
|
||||
procedure.find_column(label: "Nº dossier"),
|
||||
procedure.find_column(label: "Email"),
|
||||
procedure.find_column(label: "France connecté ?"),
|
||||
procedure.find_column(label: "Établissement SIRET"),
|
||||
procedure.find_column(label: "Établissement siège social"),
|
||||
procedure.find_column(label: "Établissement NAF"),
|
||||
procedure.find_column(label: "Libellé NAF"),
|
||||
procedure.find_column(label: "Établissement Adresse"),
|
||||
procedure.find_column(label: "Établissement numero voie"),
|
||||
procedure.find_column(label: "Établissement type voie"),
|
||||
procedure.find_column(label: "Établissement nom voie"),
|
||||
procedure.find_column(label: "Établissement complément adresse"),
|
||||
procedure.find_column(label: "Établissement code postal"),
|
||||
procedure.find_column(label: "Établissement localité"),
|
||||
procedure.find_column(label: "Établissement code INSEE localité"),
|
||||
procedure.find_column(label: "Entreprise SIREN"),
|
||||
procedure.find_column(label: "Entreprise capital social"),
|
||||
procedure.find_column(label: "Entreprise numero TVA intracommunautaire"),
|
||||
procedure.find_column(label: "Entreprise forme juridique"),
|
||||
procedure.find_column(label: "Entreprise forme juridique code"),
|
||||
procedure.find_column(label: "Entreprise nom commercial"),
|
||||
procedure.find_column(label: "Entreprise raison sociale"),
|
||||
procedure.find_column(label: "Entreprise SIRET siège social"),
|
||||
procedure.find_column(label: "Entreprise code effectif entreprise")
|
||||
]
|
||||
actuals = procedure.usager_columns_for_export
|
||||
expected.each do |expected_col|
|
||||
expect(actuals.map(&:h_id)).to include(expected_col.h_id)
|
||||
end
|
||||
|
||||
expect(actuals.any? { _1.label == "Nom" }).to eq false
|
||||
end
|
||||
end
|
||||
|
||||
context 'when procedure chorusable' do
|
||||
let(:procedure) { create(:procedure_with_dossiers, :filled_chorus, types_de_champ_public:) }
|
||||
it 'returns specific chorus columns' do
|
||||
allow_any_instance_of(Procedure).to receive(:chorusable?).and_return(true)
|
||||
expected = [
|
||||
procedure.find_column(label: "Domaine Fonctionnel"),
|
||||
procedure.find_column(label: "Référentiel De Programmation"),
|
||||
procedure.find_column(label: "Centre De Coût")
|
||||
]
|
||||
actuals = procedure.usager_columns_for_export.map(&:h_id)
|
||||
expected.each do |expected_col|
|
||||
expect(actuals).to include(expected_col.h_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#dossier_columns_for_export' do
|
||||
let(:procedure) { create(:procedure_with_dossiers, :routee, :published, types_de_champ_public:, for_individual:) }
|
||||
|
||||
it "returns all dossier columns" do
|
||||
expected = [
|
||||
procedure.find_column(label: "Archivé"),
|
||||
procedure.find_column(label: "État du dossier"),
|
||||
procedure.find_column(label: "Date du dernier évènement"),
|
||||
procedure.find_column(label: "Date de dernière modification (usager)"),
|
||||
procedure.find_column(label: "Date de dépot"),
|
||||
procedure.find_column(label: "Date de passage en instruction"),
|
||||
procedure.find_column(label: "Date de traitement"),
|
||||
procedure.find_column(label: "Motivation de la décision"),
|
||||
procedure.find_column(label: "Instructeurs"),
|
||||
procedure.find_column(label: "Groupe instructeur")
|
||||
]
|
||||
actuals = procedure.dossier_columns_for_export.map(&:h_id)
|
||||
expected.each do |expected_col|
|
||||
expect(actuals).to include(expected_col.h_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -81,7 +81,7 @@ RSpec.describe Export, type: :model do
|
|||
let(:instructeur) { create(:instructeur) }
|
||||
let!(:gi_1) { create(:groupe_instructeur, procedure: procedure, instructeurs: [instructeur]) }
|
||||
let!(:pp) { gi_1.instructeurs.first.procedure_presentation_and_errors_for_procedure_id(procedure.id).first }
|
||||
let(:created_at_column) { FilteredColumn.new(column: procedure.find_column(label: 'Créé le'), filter: '10/12/2021') }
|
||||
let(:created_at_column) { FilteredColumn.new(column: procedure.find_column(label: 'Date de création'), filter: '10/12/2021') }
|
||||
|
||||
before { pp.update(tous_filters: [created_at_column]) }
|
||||
|
||||
|
@ -95,7 +95,7 @@ RSpec.describe Export, type: :model do
|
|||
expect { Export.find_or_create_fresh_export(:zip, [gi_1], instructeur, time_span_type: Export.time_span_types.fetch(:everything), statut: Export.statuts.fetch(:tous), procedure_presentation: pp) }
|
||||
.to change { Export.count }.by(1)
|
||||
|
||||
update_at_column = FilteredColumn.new(column: procedure.find_column(label: 'Mis à jour le'), filter: '10/12/2021')
|
||||
update_at_column = FilteredColumn.new(column: procedure.find_column(label: 'Date du dernier évènement'), filter: '10/12/2021')
|
||||
pp.update(tous_filters: [created_at_column, update_at_column])
|
||||
|
||||
expect { Export.find_or_create_fresh_export(:zip, [gi_1], instructeur, time_span_type: Export.time_span_types.fetch(:everything), statut: Export.statuts.fetch(:tous), procedure_presentation: pp) }
|
||||
|
@ -181,7 +181,7 @@ RSpec.describe Export, type: :model do
|
|||
let(:statut) { 'tous' }
|
||||
|
||||
let(:procedure_presentation) do
|
||||
statut_column = procedure.find_column(label: 'Statut')
|
||||
statut_column = procedure.dossier_state_column
|
||||
en_construction_filter = FilteredColumn.new(column: statut_column, filter: 'en_construction')
|
||||
create(:procedure_presentation,
|
||||
procedure:,
|
||||
|
|
|
@ -77,7 +77,7 @@ describe ProcedurePresentation do
|
|||
end
|
||||
|
||||
context 'when filter is state' do
|
||||
let(:filtered_column) { to_filter(['Statut', "en_construction"]) }
|
||||
let(:filtered_column) { to_filter(['État du dossier', "en_construction"]) }
|
||||
|
||||
it 'should get i18n value' do
|
||||
expect(subject).to eq("En construction")
|
||||
|
@ -85,7 +85,7 @@ describe ProcedurePresentation do
|
|||
end
|
||||
|
||||
context 'when filter is a date' do
|
||||
let(:filtered_column) { to_filter(['Créé le', "15/06/2023"]) }
|
||||
let(:filtered_column) { to_filter(['Date de création', "15/06/2023"]) }
|
||||
|
||||
it 'should get formatted value' do
|
||||
expect(subject).to eq("15/06/2023")
|
||||
|
@ -94,8 +94,8 @@ describe ProcedurePresentation do
|
|||
end
|
||||
|
||||
describe '#update_displayed_fields' do
|
||||
let(:en_construction_column) { procedure.find_column(label: 'En construction le') }
|
||||
let(:mise_a_jour_column) { procedure.find_column(label: 'Mis à jour le') }
|
||||
let(:en_construction_column) { procedure.find_column(label: 'Date de passage en construction') }
|
||||
let(:mise_a_jour_column) { procedure.find_column(label: 'Date du dernier évènement') }
|
||||
|
||||
let(:procedure_presentation) do
|
||||
create(:procedure_presentation, assign_to:).tap do |pp|
|
||||
|
|
|
@ -41,7 +41,7 @@ describe DossierFilterService do
|
|||
|
||||
context 'when a filter is present' do
|
||||
let(:filtered_ids) { [dossier_1, dossier_2, dossier_3].map(&:id) }
|
||||
let(:filters) { [to_filter(['Statut', 'en_construction'])] }
|
||||
let(:filters) { [to_filter(['État du dossier', 'en_construction'])] }
|
||||
|
||||
before do
|
||||
expect(described_class).to receive(:filtered_ids).and_return(filtered_ids)
|
||||
|
@ -102,7 +102,7 @@ describe DossierFilterService do
|
|||
let(:order) { 'asc' } # Desc works the same, no extra test required
|
||||
|
||||
context 'for created_at column' do
|
||||
let!(:column) { procedure.find_column(label: 'Créé le') }
|
||||
let!(:column) { procedure.find_column(label: 'Date de création') }
|
||||
let!(:recent_dossier) { Timecop.freeze(Time.zone.local(2018, 10, 17)) { create(:dossier, procedure:) } }
|
||||
let!(:older_dossier) { Timecop.freeze(Time.zone.local(2003, 11, 11)) { create(:dossier, procedure:) } }
|
||||
|
||||
|
@ -110,7 +110,7 @@ describe DossierFilterService do
|
|||
end
|
||||
|
||||
context 'for en_construction_at column' do
|
||||
let!(:column) { procedure.find_column(label: 'En construction le') }
|
||||
let!(:column) { procedure.find_column(label: 'Date de passage en construction') }
|
||||
let!(:recent_dossier) { create(:dossier, :en_construction, procedure:, en_construction_at: Time.zone.local(2018, 10, 17)) }
|
||||
let!(:older_dossier) { create(:dossier, :en_construction, procedure:, en_construction_at: Time.zone.local(2013, 1, 1)) }
|
||||
|
||||
|
@ -118,7 +118,7 @@ describe DossierFilterService do
|
|||
end
|
||||
|
||||
context 'for updated_at column' do
|
||||
let(:column) { procedure.find_column(label: 'Mis à jour le') }
|
||||
let(:column) { procedure.find_column(label: 'Date du dernier évènement') }
|
||||
let(:recent_dossier) { create(:dossier, procedure:) }
|
||||
let(:older_dossier) { create(:dossier, procedure:) }
|
||||
|
||||
|
@ -251,7 +251,7 @@ describe DossierFilterService do
|
|||
end
|
||||
|
||||
context 'for email column' do
|
||||
let(:column) { procedure.find_column(label: 'Email instructeur') }
|
||||
let(:column) { procedure.find_column(label: 'Instructeurs') }
|
||||
|
||||
it { is_expected.to eq([dossier_a, dossier_z, dossier_without_instructeur].map(&:id)) }
|
||||
end
|
||||
|
@ -275,7 +275,7 @@ describe DossierFilterService do
|
|||
|
||||
context 'for other tables' do
|
||||
# All other columns and tables work the same so it’s ok to test only one
|
||||
let(:column) { procedure.find_column(label: 'Code postal') }
|
||||
let(:column) { procedure.find_column(label: 'Établissement code postal') }
|
||||
let(:order) { 'asc' } # Desc works the same, no extra test required
|
||||
|
||||
let!(:huitieme_dossier) { create(:dossier, procedure:, etablissement: create(:etablissement, code_postal: '75008')) }
|
||||
|
@ -297,7 +297,7 @@ describe DossierFilterService do
|
|||
|
||||
context 'for self table' do
|
||||
context 'for created_at column' do
|
||||
let(:filter) { ['Créé le', '18/9/2018'] }
|
||||
let(:filter) { ['Date de création', '18/9/2018'] }
|
||||
|
||||
let!(:kept_dossier) { create(:dossier, procedure:, created_at: Time.zone.local(2018, 9, 18, 14, 28)) }
|
||||
let!(:discarded_dossier) { create(:dossier, procedure:, created_at: Time.zone.local(2018, 9, 17, 23, 59)) }
|
||||
|
@ -306,7 +306,7 @@ describe DossierFilterService do
|
|||
end
|
||||
|
||||
context 'for en_construction_at column' do
|
||||
let(:filter) { ['En construction le', '17/10/2018'] }
|
||||
let(:filter) { ['Date de passage en construction', '17/10/2018'] }
|
||||
|
||||
let!(:kept_dossier) { create(:dossier, :en_construction, procedure:, en_construction_at: Time.zone.local(2018, 10, 17)) }
|
||||
let!(:discarded_dossier) { create(:dossier, :en_construction, procedure:, en_construction_at: Time.zone.local(2013, 1, 1)) }
|
||||
|
@ -315,7 +315,7 @@ describe DossierFilterService do
|
|||
end
|
||||
|
||||
context 'for updated_at column' do
|
||||
let(:filter) { ['Mis à jour le', '18/9/2018'] }
|
||||
let(:filter) { ['Date du dernier évènement', '18/9/2018'] }
|
||||
|
||||
let(:kept_dossier) { create(:dossier, procedure:) }
|
||||
let(:discarded_dossier) { create(:dossier, procedure:) }
|
||||
|
@ -329,7 +329,7 @@ describe DossierFilterService do
|
|||
end
|
||||
|
||||
context 'for updated_since column' do
|
||||
let(:filter) { ['Mis à jour depuis', '18/9/2018'] }
|
||||
let(:filter) { ['Dernier évènement depuis', '18/9/2018'] }
|
||||
|
||||
let(:kept_dossier) { create(:dossier, procedure:) }
|
||||
let(:later_dossier) { create(:dossier, procedure:) }
|
||||
|
@ -362,7 +362,7 @@ describe DossierFilterService do
|
|||
end
|
||||
|
||||
context 'ignore time of day' do
|
||||
let(:filter) { ['En construction le', '17/10/2018 19:30'] }
|
||||
let(:filter) { ['Date de passage en construction', '17/10/2018 19:30'] }
|
||||
|
||||
let!(:kept_dossier) { create(:dossier, :en_construction, procedure:, en_construction_at: Time.zone.local(2018, 10, 17, 15, 56)) }
|
||||
let!(:discarded_dossier) { create(:dossier, :en_construction, procedure:, en_construction_at: Time.zone.local(2018, 10, 18, 5, 42)) }
|
||||
|
@ -372,20 +372,20 @@ describe DossierFilterService do
|
|||
|
||||
context 'for a malformed date' do
|
||||
context 'when its a string' do
|
||||
let(:filter) { ['Mis à jour le', 'malformed date'] }
|
||||
let(:filter) { ['Date du dernier évènement', 'malformed date'] }
|
||||
|
||||
it { is_expected.to match([]) }
|
||||
end
|
||||
|
||||
context 'when its a number' do
|
||||
let(:filter) { ['Mis à jour le', '177500'] }
|
||||
let(:filter) { ['Date du dernier évènement', '177500'] }
|
||||
|
||||
it { is_expected.to match([]) }
|
||||
end
|
||||
end
|
||||
|
||||
context 'with multiple search values' do
|
||||
let(:filters) { [['En construction le', '17/10/2018'], ['En construction le', '19/10/2018']] }
|
||||
let(:filters) { [['Date de passage en construction', '17/10/2018'], ['Date de passage en construction', '19/10/2018']] }
|
||||
|
||||
let!(:kept_dossier) { create(:dossier, :en_construction, procedure:, en_construction_at: Time.zone.local(2018, 10, 17)) }
|
||||
let!(:other_kept_dossier) { create(:dossier, :en_construction, procedure:, en_construction_at: Time.zone.local(2018, 10, 19)) }
|
||||
|
@ -397,7 +397,7 @@ describe DossierFilterService do
|
|||
end
|
||||
|
||||
context 'with multiple state filters' do
|
||||
let(:filters) { [['Statut', 'en_construction'], ['Statut', 'en_instruction']] }
|
||||
let(:filters) { [['État du dossier', 'en_construction'], ['État du dossier', 'en_instruction']] }
|
||||
|
||||
let!(:kept_dossier) { create(:dossier, :en_construction, procedure:) }
|
||||
let!(:other_kept_dossier) { create(:dossier, :en_instruction, procedure:) }
|
||||
|
@ -409,7 +409,7 @@ describe DossierFilterService do
|
|||
end
|
||||
|
||||
context 'with en_construction state filters' do
|
||||
let(:filter) { ['Statut', 'en_construction'] }
|
||||
let(:filter) { ['État du dossier', 'en_construction'] }
|
||||
|
||||
let!(:en_construction) { create(:dossier, :en_construction, procedure:) }
|
||||
let!(:en_construction_with_correction) { create(:dossier, :en_construction, procedure:) }
|
||||
|
@ -580,7 +580,7 @@ describe DossierFilterService do
|
|||
|
||||
context 'for etablissement table' do
|
||||
context 'for entreprise_date_creation column' do
|
||||
let(:filter) { ['Date de création', '21/6/2018'] }
|
||||
let(:filter) { ['Entreprise date de création', '21/6/2018'] }
|
||||
|
||||
let!(:kept_dossier) { create(:dossier, procedure:, etablissement: create(:etablissement, entreprise_date_creation: Time.zone.local(2018, 6, 21))) }
|
||||
let!(:discarded_dossier) { create(:dossier, procedure:, etablissement: create(:etablissement, entreprise_date_creation: Time.zone.local(2008, 6, 21))) }
|
||||
|
@ -588,7 +588,7 @@ describe DossierFilterService do
|
|||
it { is_expected.to contain_exactly(kept_dossier.id) }
|
||||
|
||||
context 'with multiple search values' do
|
||||
let(:filters) { [['Date de création', '21/6/2016'], ['Date de création', '21/6/2018']] }
|
||||
let(:filters) { [['Entreprise date de création', '21/6/2016'], ['Entreprise date de création', '21/6/2018']] }
|
||||
|
||||
let!(:other_kept_dossier) { create(:dossier, procedure:, etablissement: create(:etablissement, entreprise_date_creation: Time.zone.local(2016, 6, 21))) }
|
||||
|
||||
|
@ -601,7 +601,7 @@ describe DossierFilterService do
|
|||
context 'for code_postal column' do
|
||||
# All columns except entreprise_date_creation work exacly the same, just testing one
|
||||
|
||||
let(:filter) { ['Code postal', '75017'] }
|
||||
let(:filter) { ['Établissement code postal', '75017'] }
|
||||
|
||||
let!(:kept_dossier) { create(:dossier, procedure:, etablissement: create(:etablissement, code_postal: '75017')) }
|
||||
let!(:discarded_dossier) { create(:dossier, procedure:, etablissement: create(:etablissement, code_postal: '25000')) }
|
||||
|
@ -609,7 +609,7 @@ describe DossierFilterService do
|
|||
it { is_expected.to contain_exactly(kept_dossier.id) }
|
||||
|
||||
context 'with multiple search values' do
|
||||
let(:filters) { [['Code postal', '75017'], ['Code postal', '88100']] }
|
||||
let(:filters) { [['Établissement code postal', '75017'], ['Établissement code postal', '88100']] }
|
||||
|
||||
let!(:other_kept_dossier) { create(:dossier, procedure:, etablissement: create(:etablissement, code_postal: '88100')) }
|
||||
|
||||
|
@ -674,7 +674,7 @@ describe DossierFilterService do
|
|||
end
|
||||
|
||||
context 'for followers_instructeurs table' do
|
||||
let(:filter) { ['Email instructeur', 'keepmail'] }
|
||||
let(:filter) { ['Instructeurs', 'keepmail'] }
|
||||
|
||||
let!(:kept_dossier) { create(:dossier, procedure:) }
|
||||
let!(:discarded_dossier) { create(:dossier, procedure:) }
|
||||
|
@ -687,7 +687,7 @@ describe DossierFilterService do
|
|||
it { is_expected.to contain_exactly(kept_dossier.id) }
|
||||
|
||||
context 'with multiple search values' do
|
||||
let(:filters) { [['Email instructeur', 'keepmail'], ['Email instructeur', 'beta.gouv.fr']] }
|
||||
let(:filters) { [['Instructeurs', 'keepmail'], ['Instructeurs', 'beta.gouv.fr']] }
|
||||
|
||||
let(:other_kept_dossier) { create(:dossier, procedure:) }
|
||||
|
||||
|
|
|
@ -80,28 +80,28 @@ describe DossierProjectionService do
|
|||
|
||||
context 'for self table' do
|
||||
context 'for created_at column' do
|
||||
let(:label) { 'Créé le' }
|
||||
let(:label) { 'Date de création' }
|
||||
let(:dossier) { Timecop.freeze(Time.zone.local(1992, 3, 22)) { create(:dossier, procedure:) } }
|
||||
|
||||
it { is_expected.to eq('22/03/1992') }
|
||||
end
|
||||
|
||||
context 'for en_construction_at column' do
|
||||
let(:label) { 'En construction le' }
|
||||
let(:label) { 'Date de passage en construction' }
|
||||
let(:dossier) { create(:dossier, :en_construction, en_construction_at: Time.zone.local(2018, 10, 17), procedure:) }
|
||||
|
||||
it { is_expected.to eq('17/10/2018') }
|
||||
end
|
||||
|
||||
context 'for depose_at column' do
|
||||
let(:label) { 'Déposé le' }
|
||||
let(:label) { 'Date de dépot' }
|
||||
let(:dossier) { create(:dossier, :en_construction, depose_at: Time.zone.local(2018, 10, 17), procedure:) }
|
||||
|
||||
it { is_expected.to eq('17/10/2018') }
|
||||
end
|
||||
|
||||
context 'for updated_at column' do
|
||||
let(:label) { 'Mis à jour le' }
|
||||
let(:label) { 'Date du dernier évènement' }
|
||||
let(:dossier) { create(:dossier, procedure:) }
|
||||
|
||||
before { dossier.touch(time: Time.zone.local(2018, 9, 25)) }
|
||||
|
@ -142,7 +142,7 @@ describe DossierProjectionService do
|
|||
end
|
||||
|
||||
context 'for etablissement table' do
|
||||
let(:label) { 'Code postal' }
|
||||
let(:label) { 'Établissement code postal' }
|
||||
|
||||
let!(:dossier) { create(:dossier, procedure:, etablissement: create(:etablissement, code_postal: '75008')) }
|
||||
|
||||
|
@ -158,7 +158,7 @@ describe DossierProjectionService do
|
|||
end
|
||||
|
||||
context 'for followers_instructeurs table' do
|
||||
let(:label) { 'Email instructeur' }
|
||||
let(:label) { 'Instructeurs' }
|
||||
|
||||
let(:dossier) { create(:dossier, procedure:) }
|
||||
let!(:follow1) { create(:follow, dossier: dossier, instructeur: create(:instructeur, email: 'b@host.fr')) }
|
||||
|
|
|
@ -44,9 +44,9 @@ describe "procedure filters" do
|
|||
end
|
||||
|
||||
scenario "should add be able to add created_at column", js: true do
|
||||
add_column("Créé le")
|
||||
add_column("Date de création")
|
||||
within ".dossiers-table" do
|
||||
expect(page).to have_link("Créé le")
|
||||
expect(page).to have_link("Date de création")
|
||||
expect(page).to have_link(new_unfollow_dossier.created_at.strftime('%d/%m/%Y'))
|
||||
end
|
||||
end
|
||||
|
@ -99,10 +99,10 @@ describe "procedure filters" do
|
|||
|
||||
scenario "should be able to user custom fiters", js: true do
|
||||
# use date filter
|
||||
add_filter("En construction le", "10/10/2010", type: :date)
|
||||
add_filter("Date de passage en construction", "10/10/2010", type: :date)
|
||||
|
||||
# use statut dropdown filter
|
||||
add_filter('Statut', 'En construction', type: :enum)
|
||||
add_filter('État du dossier', 'En construction', type: :enum)
|
||||
|
||||
# use choice dropdown filter
|
||||
add_filter('Choix unique', 'val1', type: :enum)
|
||||
|
|
Loading…
Reference in a new issue