On n'importe pas tous les bureaux de vote

This commit is contained in:
Emmy D'Anello 2024-06-13 13:40:47 +02:00
parent 6c28527829
commit fbbe34518e
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 4 additions and 0 deletions

View File

@ -128,6 +128,10 @@ def importer_bureaux_vote(engine: Engine, verbose: bool = False) -> None:
session.add(Commune(code_insee=code_commune, libelle=bv_dict['com_name'], departement_code=dpt_code, session.add(Commune(code_insee=code_commune, libelle=bv_dict['com_name'], departement_code=dpt_code,
geometry={})) geometry={}))
if not session.execute(select(Commune).filter_by(code_insee=code_commune)).scalar_one_or_none():
print("Commune non trouvée avec le code", code_commune, "et le nom", bv_dict['com_name'])
continue
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=dpt_code, numero=numero_circo)) session.add(Circonscription(id=code_circo, departement_code=dpt_code, numero=numero_circo))