parent
18e91e7ca3
commit
839b0d7e6d
2 changed files with 59 additions and 6 deletions
|
@ -475,11 +475,21 @@ class Dossier < ApplicationRecord
|
||||||
def spreadsheet_columns
|
def spreadsheet_columns
|
||||||
columns = [
|
columns = [
|
||||||
['ID', id.to_s],
|
['ID', id.to_s],
|
||||||
['Email', user.email],
|
['Email', user.email]
|
||||||
['Civilité', individual&.gender],
|
]
|
||||||
['Nom', individual&.nom],
|
|
||||||
['Prénom', individual&.prenom],
|
if procedure.for_individual?
|
||||||
['Date de naissance', individual&.birthdate],
|
columns += [
|
||||||
|
['Civilité', individual&.gender],
|
||||||
|
['Nom', individual&.nom],
|
||||||
|
['Prénom', individual&.prenom],
|
||||||
|
['Date de naissance', individual&.birthdate]
|
||||||
|
]
|
||||||
|
else
|
||||||
|
columns << ['Entreprise raison sociale', etablissement&.entreprise_raison_sociale]
|
||||||
|
end
|
||||||
|
|
||||||
|
columns += [
|
||||||
['Archivé', :archived],
|
['Archivé', :archived],
|
||||||
['État du dossier', I18n.t(state, scope: [:activerecord, :attributes, :dossier, :state])],
|
['État du dossier', I18n.t(state, scope: [:activerecord, :attributes, :dossier, :state])],
|
||||||
['Dernière mise à jour le', :updated_at],
|
['Dernière mise à jour le', :updated_at],
|
||||||
|
|
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe ProcedureExportV2Service do
|
describe ProcedureExportV2Service do
|
||||||
describe 'to_data' do
|
describe 'to_data' do
|
||||||
let(:procedure) { create(:procedure, :published, :with_all_champs) }
|
let(:procedure) { create(:procedure, :published, :for_individual, :with_all_champs) }
|
||||||
subject do
|
subject do
|
||||||
Tempfile.create do |f|
|
Tempfile.create do |f|
|
||||||
f << ProcedureExportV2Service.new(procedure, procedure.dossiers).to_xlsx
|
f << ProcedureExportV2Service.new(procedure, procedure.dossiers).to_xlsx
|
||||||
|
@ -104,12 +104,55 @@ describe ProcedureExportV2Service do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with etablissement' do
|
context 'with etablissement' do
|
||||||
|
let(:procedure) { create(:procedure, :published, :with_all_champs) }
|
||||||
let!(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :with_entreprise, procedure: procedure) }
|
let!(:dossier) { create(:dossier, :en_instruction, :with_all_champs, :with_entreprise, procedure: procedure) }
|
||||||
|
|
||||||
let(:dossier_etablissement) { etablissements_sheet.data[1] }
|
let(:dossier_etablissement) { etablissements_sheet.data[1] }
|
||||||
let(:champ_etablissement) { etablissements_sheet.data[0] }
|
let(:champ_etablissement) { etablissements_sheet.data[0] }
|
||||||
|
|
||||||
|
let(:nominal_headers) do
|
||||||
|
[
|
||||||
|
"ID",
|
||||||
|
"Email",
|
||||||
|
"Entreprise raison sociale",
|
||||||
|
"Archivé",
|
||||||
|
"État du dossier",
|
||||||
|
"Dernière mise à jour le",
|
||||||
|
"Déposé le",
|
||||||
|
"Passé en instruction le",
|
||||||
|
"Traité le",
|
||||||
|
"Motivation de la décision",
|
||||||
|
"Instructeurs",
|
||||||
|
"textarea",
|
||||||
|
"date",
|
||||||
|
"datetime",
|
||||||
|
"number",
|
||||||
|
"decimal_number",
|
||||||
|
"integer_number",
|
||||||
|
"checkbox",
|
||||||
|
"civilite",
|
||||||
|
"email",
|
||||||
|
"phone",
|
||||||
|
"address",
|
||||||
|
"yes_no",
|
||||||
|
"simple_drop_down_list",
|
||||||
|
"multiple_drop_down_list",
|
||||||
|
"linked_drop_down_list",
|
||||||
|
"pays",
|
||||||
|
"regions",
|
||||||
|
"departements",
|
||||||
|
"engagement",
|
||||||
|
"dossier_link",
|
||||||
|
"piece_justificative",
|
||||||
|
"siret",
|
||||||
|
"carte",
|
||||||
|
"text"
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
it 'should have headers' do
|
it 'should have headers' do
|
||||||
|
expect(dossiers_sheet.headers).to match(nominal_headers)
|
||||||
|
|
||||||
expect(etablissements_sheet.headers).to eq([
|
expect(etablissements_sheet.headers).to eq([
|
||||||
"Dossier ID",
|
"Dossier ID",
|
||||||
"Champ",
|
"Champ",
|
||||||
|
|
Loading…
Reference in a new issue