Skip to content

Commit

Permalink
Gestion des CPs multiples dans les exports JSON (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
vdct committed Feb 7, 2024
1 parent d364126 commit eb8bcc0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bano/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,17 @@ def save_as_json(dept):
l['postcode'] = l['postcode'].split(';')
jsonfile.write(f"{json.dumps(l,ensure_ascii=False,separators=(',',':'))}\n")
for l in sql_get_dict_data('export_json_dept_voies_avec_adresses',dict(dept=dept)):
if ';' in l['postcode']:
l['postcode'] = l['postcode'].split(';')
dict_hsnr = {}
for p in l['housenumbers'].split('@@@'):
numero,lat,lon = p.split('$$$')
dict_hsnr[numero] = dict(lat=float(lat),lon=float(lon))
l['housenumbers'] = dict_hsnr
jsonfile.write(f"{json.dumps(l,ensure_ascii=False,separators=(',',':'))}\n")
for l in sql_get_dict_data('export_json_dept_voies_ld_sans_adresses',dict(dept=dept)):
if ';' in l['postcode']:
l['postcode'] = l['postcode'].split(';')
jsonfile.write(f"{json.dumps(l,ensure_ascii=False,separators=(',',':'))}\n")
b.batch_stop_log(id_batch, True)
except Exception as e:
Expand Down

0 comments on commit eb8bcc0

Please sign in to comment.