Corrections quelques bureaux de vote
This commit is contained in:
parent
66b8fb8103
commit
df85902b5b
|
@ -5,7 +5,7 @@ from sqlalchemy.orm import Session
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
from nupes.cache import get_file
|
from nupes.cache import get_file
|
||||||
from nupes.models import BureauVote, Departement
|
from nupes.models import BureauVote
|
||||||
from nupes.models.europeennes2024 import *
|
from nupes.models.europeennes2024 import *
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,6 +20,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.startswith("987"): # Les communes de Polynésie française ne sont pas importées
|
||||||
|
continue
|
||||||
|
|
||||||
if com_code == "60694":
|
if com_code == "60694":
|
||||||
com_code = "60054" # Les Hauts-Talicans, données pas à jour
|
com_code = "60054" # Les Hauts-Talicans, données pas à jour
|
||||||
elif com_code in ["85165", "85212"]:
|
elif com_code in ["85165", "85212"]:
|
||||||
|
@ -117,9 +120,12 @@ def importer_resultats_commune(engine: Engine, verbose: bool = False) -> None:
|
||||||
com_code = str(row['Code commune']).zfill(5)
|
com_code = str(row['Code commune']).zfill(5)
|
||||||
dpt_code = row['Code département']
|
dpt_code = row['Code département']
|
||||||
|
|
||||||
if dpt_code == "ZX":
|
if dpt_code == "ZX": # Saint-Martin/Saint-Barthélémy
|
||||||
dpt_code = "977"
|
dpt_code = "977"
|
||||||
|
|
||||||
|
if dpt_code == "987": # Les communes de Polynésie française ne sont pas importées
|
||||||
|
continue
|
||||||
|
|
||||||
if com_code == "60694":
|
if com_code == "60694":
|
||||||
com_code = "60054" # Les Hauts-Talicans, données pas à jour
|
com_code = "60054" # Les Hauts-Talicans, données pas à jour
|
||||||
elif com_code in ["85165", "85212"]:
|
elif com_code in ["85165", "85212"]:
|
||||||
|
|
|
@ -250,6 +250,14 @@ def importer_bureaux_vote(engine: Engine, verbose: bool = False) -> None:
|
||||||
numero_circo = int(bv_dict['codeCirconscription'][len(dpt_code):])
|
numero_circo = int(bv_dict['codeCirconscription'][len(dpt_code):])
|
||||||
code_circo = f"{dpt_code}-{numero_circo:02d}"
|
code_circo = f"{dpt_code}-{numero_circo:02d}"
|
||||||
bv_id = bv_dict['id_bv'].split()[0]
|
bv_id = bv_dict['id_bv'].split()[0]
|
||||||
|
|
||||||
|
if code_commune == "57447":
|
||||||
|
# Petites erreurs sur la commune de Marly
|
||||||
|
code_bv = int(bv_id.split('_')[1])
|
||||||
|
elif bv_id == "59508_3":
|
||||||
|
# Petite erreur à Roncq
|
||||||
|
code_bv = 103
|
||||||
|
|
||||||
bv_libelle = f"Bureau {code_bv} de {bv_dict['nomCommune']}"
|
bv_libelle = f"Bureau {code_bv} de {bv_dict['nomCommune']}"
|
||||||
|
|
||||||
if not session.execute(select(Commune).filter_by(code_insee=code_commune)).scalar_one_or_none():
|
if not session.execute(select(Commune).filter_by(code_insee=code_commune)).scalar_one_or_none():
|
||||||
|
|
Loading…
Reference in New Issue