Correction Les Hauts Talicans

This commit is contained in:
Emmy D'Anello 2024-06-16 08:44:32 +02:00
parent 5cc10f3106
commit c4ec62d315
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85

View File

@ -23,6 +23,9 @@ def importer_resultats_bv(engine: Engine, verbose: bool = False) -> None:
com_code = str(row['Code commune']).zfill(5) com_code = str(row['Code commune']).zfill(5)
bv_code = row['Code BV'] bv_code = row['Code BV']
if com_code == "60694":
com_code = "60054" # Les Hauts-Talicans, données pas à jour
if bv := session.execute(select(BureauVote).filter_by(commune_code=com_code, code_bureau=bv_code)) \ if bv := session.execute(select(BureauVote).filter_by(commune_code=com_code, code_bureau=bv_code)) \
.scalar_one_or_none(): .scalar_one_or_none():
bv_id = bv.id bv_id = bv.id
@ -107,6 +110,9 @@ def importer_resultats_commune(engine: Engine, verbose: bool = False) -> None:
if dpt_code == "ZX": if dpt_code == "ZX":
dpt_code = "977" dpt_code = "977"
if com_code == "60694":
com_code = "60054" # Les Hauts-Talicans, données pas à jour
resultats_commune = session.execute(select(ResultatsCommune).filter_by(commune_id=com_code)) \ resultats_commune = session.execute(select(ResultatsCommune).filter_by(commune_id=com_code)) \
.scalar_one_or_none() .scalar_one_or_none()
if not resultats_commune: if not resultats_commune: