fix(normalized_address): should not raise an error for addresses without code postal

This commit is contained in:
mfo 2024-09-13 11:19:05 +02:00
parent eb3d2cb20c
commit 7a78fdc913
No known key found for this signature in database
GPG key ID: 7CE3E1F5B794A8EC

View file

@ -32,10 +32,14 @@ class AddressProxy
@city_name = etablissement.localite
@postal_code = etablissement.code_postal
@city_code = etablissement.code_insee_localite
@departement_name = APIGeoService.departement_name_by_postal_code(@postal_code)
@departement_code = APIGeoService.departement_code(@departement_name)
@region_code = APIGeoService.region_code_by_departement(@departement_code)
@region_name = APIGeoService.region_name(@region_code)
if @postal_code
@departement_name = APIGeoService.departement_name_by_postal_code(@postal_code)
@departement_code = APIGeoService.departement_code(@departement_name)
@region_code = APIGeoService.region_code_by_departement(@departement_code)
@region_name = APIGeoService.region_name(@region_code)
else # adresse without postal_code, ex:
@departement_name, @departement_code, @region_code, @region_name = nil
end
end
end