add data from rnf field to export
This commit is contained in:
parent
a6f4ae3ee4
commit
daa4c28af7
4 changed files with 30 additions and 0 deletions
|
@ -20,4 +20,12 @@ class Champs::RNFChamp < Champ
|
|||
def blank?
|
||||
rnf_id.blank?
|
||||
end
|
||||
|
||||
def for_export
|
||||
if data
|
||||
[rnf_id, data['title'], data.dig('address', 'label'), data.dig('address', 'cityCode'), "#{data['department']} - #{APIGeoService.departement_name(data['department'])}"]
|
||||
else
|
||||
[rnf_id, nil, nil, nil, nil]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,2 +1,5 @@
|
|||
class TypesDeChamp::RNFTypeDeChamp < TypesDeChamp::TextTypeDeChamp
|
||||
def libelle_for_export(index)
|
||||
[libelle, "#{libelle} (Nom)", "#{libelle} (Adresse)", "#{libelle} (Code insee Ville)", "#{libelle} (Département)"][index]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -73,4 +73,11 @@ describe Champs::RNFChamp, type: :model do
|
|||
}
|
||||
end
|
||||
end
|
||||
|
||||
describe 'for_export' do
|
||||
let(:champ) { build(:champ_rnf, external_id:, data: JSON.parse(body)) }
|
||||
it do
|
||||
expect(champ.for_export).to eq(['075-FDD-00003-01', 'Fondation SFR', '16 Rue du Général de Boissieu 75015 Paris', '75115', '75 - Paris'])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -92,6 +92,10 @@ describe ProcedureExportService do
|
|||
"cojo",
|
||||
"expression_reguliere",
|
||||
"rnf",
|
||||
"rnf (Nom)",
|
||||
"rnf (Adresse)",
|
||||
"rnf (Code insee Ville)",
|
||||
"rnf (Département)",
|
||||
"engagement_juridique"
|
||||
]
|
||||
end
|
||||
|
@ -221,6 +225,10 @@ describe ProcedureExportService do
|
|||
"cojo",
|
||||
"expression_reguliere",
|
||||
"rnf",
|
||||
"rnf (Nom)",
|
||||
"rnf (Adresse)",
|
||||
"rnf (Code insee Ville)",
|
||||
"rnf (Département)",
|
||||
"engagement_juridique"
|
||||
]
|
||||
end
|
||||
|
@ -318,6 +326,10 @@ describe ProcedureExportService do
|
|||
"cojo",
|
||||
"expression_reguliere",
|
||||
"rnf",
|
||||
"rnf (Nom)",
|
||||
"rnf (Adresse)",
|
||||
"rnf (Code insee Ville)",
|
||||
"rnf (Département)",
|
||||
"engagement_juridique"
|
||||
]
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue