[fix #3154] order export
This commit is contained in:
parent
eeea623cf9
commit
5a87fad02e
2 changed files with 14 additions and 4 deletions
|
@ -142,10 +142,10 @@ class ProcedureExportService
|
||||||
headers = ATTRIBUTES.map do |key|
|
headers = ATTRIBUTES.map do |key|
|
||||||
label_for_export(key.to_s)
|
label_for_export(key.to_s)
|
||||||
end
|
end
|
||||||
headers += @procedure.types_de_champ.map do |champ|
|
headers += @procedure.types_de_champ.ordered.map do |champ|
|
||||||
label_for_export(champ.libelle)
|
label_for_export(champ.libelle)
|
||||||
end
|
end
|
||||||
headers += @procedure.types_de_champ_private.map do |champ|
|
headers += @procedure.types_de_champ_private.ordered.map do |champ|
|
||||||
label_for_export(champ.libelle)
|
label_for_export(champ.libelle)
|
||||||
end
|
end
|
||||||
headers += ETABLISSEMENT_ATTRIBUTES.map do |key|
|
headers += ETABLISSEMENT_ATTRIBUTES.map do |key|
|
||||||
|
|
|
@ -9,6 +9,14 @@ describe ProcedureExportService do
|
||||||
let(:headers) { subject[:headers] }
|
let(:headers) { subject[:headers] }
|
||||||
let(:data) { subject[:data] }
|
let(:data) { subject[:data] }
|
||||||
|
|
||||||
|
before do
|
||||||
|
# change one tdc place to check if the header is ordered
|
||||||
|
tdc_first = procedure.types_de_champ.ordered.first
|
||||||
|
tdc_last = procedure.types_de_champ.ordered.last
|
||||||
|
|
||||||
|
tdc_first.update(order_place: tdc_last.order_place + 1)
|
||||||
|
end
|
||||||
|
|
||||||
context 'dossiers' do
|
context 'dossiers' do
|
||||||
it 'should have headers' do
|
it 'should have headers' do
|
||||||
expect(headers).to eq([
|
expect(headers).to eq([
|
||||||
|
@ -27,7 +35,7 @@ describe ProcedureExportService do
|
||||||
:individual_prenom,
|
:individual_prenom,
|
||||||
:individual_nom,
|
:individual_nom,
|
||||||
:individual_birthdate,
|
:individual_birthdate,
|
||||||
:text,
|
|
||||||
:textarea,
|
:textarea,
|
||||||
:date,
|
:date,
|
||||||
:datetime,
|
:datetime,
|
||||||
|
@ -53,6 +61,8 @@ describe ProcedureExportService do
|
||||||
:piece_justificative,
|
:piece_justificative,
|
||||||
:siret,
|
:siret,
|
||||||
:carte,
|
:carte,
|
||||||
|
:text,
|
||||||
|
|
||||||
:etablissement_siret,
|
:etablissement_siret,
|
||||||
:etablissement_siege_social,
|
:etablissement_siege_social,
|
||||||
:etablissement_naf,
|
:etablissement_naf,
|
||||||
|
@ -113,7 +123,7 @@ describe ProcedureExportService do
|
||||||
}
|
}
|
||||||
|
|
||||||
let(:champs_data) {
|
let(:champs_data) {
|
||||||
dossier.champs.map(&:for_export)
|
dossier.champs.ordered.map(&:for_export)
|
||||||
}
|
}
|
||||||
|
|
||||||
let(:etablissement_data) {
|
let(:etablissement_data) {
|
||||||
|
|
Loading…
Reference in a new issue