Add groupe_instructeur_label to export v2
This commit is contained in:
parent
f577484aa2
commit
a2f82ab8be
2 changed files with 24 additions and 5 deletions
|
@ -447,7 +447,7 @@ class Dossier < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def spreadsheet_columns
|
def spreadsheet_columns
|
||||||
[
|
columns = [
|
||||||
['ID', id.to_s],
|
['ID', id.to_s],
|
||||||
['Email', user.email],
|
['Email', user.email],
|
||||||
['Civilité', individual&.gender],
|
['Civilité', individual&.gender],
|
||||||
|
@ -462,7 +462,13 @@ class Dossier < ApplicationRecord
|
||||||
['Traité le', :processed_at],
|
['Traité le', :processed_at],
|
||||||
['Motivation de la décision', :motivation],
|
['Motivation de la décision', :motivation],
|
||||||
['Instructeurs', followers_instructeurs.map(&:email).join(' ')]
|
['Instructeurs', followers_instructeurs.map(&:email).join(' ')]
|
||||||
] + champs_for_export + annotations_for_export
|
]
|
||||||
|
|
||||||
|
if procedure.routee?
|
||||||
|
columns << ['Groupe instructeur', groupe_instructeur.label]
|
||||||
|
end
|
||||||
|
|
||||||
|
columns + champs_for_export + annotations_for_export
|
||||||
end
|
end
|
||||||
|
|
||||||
def champs_for_export
|
def champs_for_export
|
||||||
|
|
|
@ -34,8 +34,8 @@ describe ProcedureExportV2Service do
|
||||||
context 'with dossier' do
|
context 'with dossier' do
|
||||||
let!(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :for_individual, procedure: procedure) }
|
let!(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :for_individual, procedure: procedure) }
|
||||||
|
|
||||||
it 'should have headers' do
|
let(:nominal_headers) do
|
||||||
expect(dossiers_sheet.headers).to eq([
|
[
|
||||||
"ID",
|
"ID",
|
||||||
"Email",
|
"Email",
|
||||||
"Civilité",
|
"Civilité",
|
||||||
|
@ -74,7 +74,11 @@ describe ProcedureExportV2Service do
|
||||||
"siret",
|
"siret",
|
||||||
"carte",
|
"carte",
|
||||||
"text"
|
"text"
|
||||||
])
|
]
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should have headers' do
|
||||||
|
expect(dossiers_sheet.headers).to match(nominal_headers)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should have data' do
|
it 'should have data' do
|
||||||
|
@ -88,6 +92,15 @@ describe ProcedureExportV2Service do
|
||||||
expect(en_construction_at).to eq(dossier.en_construction_at.round)
|
expect(en_construction_at).to eq(dossier.en_construction_at.round)
|
||||||
expect(en_instruction_at).to eq(dossier.en_instruction_at.round)
|
expect(en_instruction_at).to eq(dossier.en_instruction_at.round)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'with a procedure routee' do
|
||||||
|
before { procedure.groupe_instructeurs.create(label: '2') }
|
||||||
|
|
||||||
|
let(:routee_header) { nominal_headers.insert(nominal_headers.index('textarea'), 'Groupe instructeur') }
|
||||||
|
|
||||||
|
it { expect(dossiers_sheet.headers).to match(routee_header) }
|
||||||
|
it { expect(dossiers_sheet.data[0][dossiers_sheet.headers.index('Groupe instructeur')]).to eq('défaut') }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with etablissement' do
|
context 'with etablissement' do
|
||||||
|
|
Loading…
Add table
Reference in a new issue