Correction circonscription outre-mer
This commit is contained in:
parent
2b10c4c7b2
commit
10f7f59d55
|
@ -118,10 +118,11 @@ def importer_bureaux_vote(engine: Engine, debug: bool = False) -> None:
|
||||||
code_circo = bv_dict['circonscription_code']
|
code_circo = bv_dict['circonscription_code']
|
||||||
bv_id = f"{code_commune}_{code_bv}"
|
bv_id = f"{code_commune}_{code_bv}"
|
||||||
bv_libelle = bv_dict['libelle'] or "Bureau unique"
|
bv_libelle = bv_dict['libelle'] or "Bureau unique"
|
||||||
|
dpt_code, numero_circo = code_circo.split('-')
|
||||||
|
numero_circo = int(numero_circo)
|
||||||
|
|
||||||
if not session.execute(select(Circonscription).filter_by(id=code_circo)).scalar_one_or_none():
|
if not session.execute(select(Circonscription).filter_by(id=code_circo)).scalar_one_or_none():
|
||||||
session.add(Circonscription(id=code_circo, departement_code=code_commune[:2],
|
session.add(Circonscription(id=code_circo, departement_code=dpt_code, numero=numero_circo))
|
||||||
numero=int(code_circo[3:])))
|
|
||||||
|
|
||||||
if bv := session.execute(select(BureauVote).filter_by(id=bv_id)).scalar_one_or_none():
|
if bv := session.execute(select(BureauVote).filter_by(id=bv_id)).scalar_one_or_none():
|
||||||
bv.commune_code = code_commune
|
bv.commune_code = code_commune
|
||||||
|
|
Loading…
Reference in New Issue