From c7d5bf8dc79398ba1951cc27a9956347985734e8 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 2 Nov 2023 16:00:28 +0100 Subject: [PATCH] amelioration(export.chorus): integre le cadre budgetaire en pus des champs ej --- app/models/dossier.rb | 7 +++++++ spec/services/procedure_export_service_spec.rb | 15 +++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/app/models/dossier.rb b/app/models/dossier.rb index ed858ddab..7e137a918 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -1228,6 +1228,13 @@ class Dossier < ApplicationRecord columns << ['Entreprise raison sociale', etablissement&.entreprise_raison_sociale] end + if procedure.chorusable? && procedure.chorus.complete? + columns += [ + ['Domaine Fonctionnel', procedure.chorus_configuration.domaine_fonctionnel.code], + ['Referentiel De Programmation', procedure.chorus_configuration.referentiel_de_programmation.code], + ['Centre De Coup', procedure.chorus_configuration.centre_de_coup.code] + ] + end columns += [ ['Archivé', :archived], ['État du dossier', Dossier.human_attribute_name("state.#{state}")], diff --git a/spec/services/procedure_export_service_spec.rb b/spec/services/procedure_export_service_spec.rb index b401e9321..a7f94feb7 100644 --- a/spec/services/procedure_export_service_spec.rb +++ b/spec/services/procedure_export_service_spec.rb @@ -141,6 +141,21 @@ describe ProcedureExportService do end it { expect(dossiers_sheet.data.first.size).to eq(nominal_headers.size) } end + + context 'with procedure chorus' do + let(:procedure) { create(:procedure, :published, :for_individual, :filled_chorus, :with_all_champs) } + let!(:dossier) { create(:dossier, :en_instruction, :with_populated_champs, procedure: procedure) } + + it 'includes chorus headers' do + expected_headers = [ + 'Domaine Fonctionnel', + 'Referentiel De Programmation', + 'Centre De Coup' + ] + + expect(dossiers_sheet.headers).to match_array(nominal_headers) + end + end end describe 'Etablissement sheet' do