Sélection du type d'affichage
This commit is contained in:
@ -140,7 +140,7 @@ def exporter_resultats_regions(engine: Engine, verbose: bool = False) -> None:
|
||||
for voix_liste in resultats_region.voix_listes:
|
||||
resultats_listes[voix_liste.liste.numero] = voix_liste.voix
|
||||
|
||||
file = DATA_DIR / "resultats" / "europeennes2024" / "regions" / f"{region.code_insee}.json"
|
||||
file = DATA_DIR / "resultats" / "europeennes2024" / "region" / f"{region.code_insee}.json"
|
||||
if not file.parent.is_dir():
|
||||
file.parent.mkdir(parents=True)
|
||||
|
||||
@ -149,7 +149,7 @@ def exporter_resultats_regions(engine: Engine, verbose: bool = False) -> None:
|
||||
|
||||
session.commit()
|
||||
|
||||
regions_file = DATA_DIR / "resultats" / "europeennes2024" / "regions" / "regions.json"
|
||||
regions_file = DATA_DIR / "resultats" / "europeennes2024" / "region" / "regions.json"
|
||||
if not regions_file.parent.is_dir():
|
||||
regions_file.parent.mkdir(parents=True)
|
||||
|
||||
@ -166,6 +166,7 @@ def exporter_resultats_departements(engine: Engine, verbose: bool = False) -> No
|
||||
for departement in iterator:
|
||||
departement_json = {'code_insee': departement.code_insee, 'nom': departement.libelle,
|
||||
'region': departement.region_code,
|
||||
'circonscriptions': [circo.id for circo in departement.circonscriptions],
|
||||
'communes': [commune.code_insee for commune in departement.communes]}
|
||||
departements_json.append(departement_json)
|
||||
|
||||
@ -194,7 +195,7 @@ def exporter_resultats_departements(engine: Engine, verbose: bool = False) -> No
|
||||
for voix_liste in resultats_departement.voix_listes:
|
||||
resultats_listes[voix_liste.liste.numero] = voix_liste.voix
|
||||
|
||||
file = DATA_DIR / "resultats" / "europeennes2024" / "departements" / f"{departement.code_insee}.json"
|
||||
file = DATA_DIR / "resultats" / "europeennes2024" / "departement" / f"{departement.code_insee}.json"
|
||||
if not file.parent.is_dir():
|
||||
file.parent.mkdir(parents=True)
|
||||
|
||||
@ -203,7 +204,7 @@ def exporter_resultats_departements(engine: Engine, verbose: bool = False) -> No
|
||||
|
||||
session.commit()
|
||||
|
||||
departements_file = DATA_DIR / "resultats" / "europeennes2024" / "departements" / "departements.json"
|
||||
departements_file = DATA_DIR / "resultats" / "europeennes2024" / "departement" / "departements.json"
|
||||
if not departements_file.parent.is_dir():
|
||||
departements_file.parent.mkdir(parents=True)
|
||||
|
||||
@ -248,7 +249,7 @@ def exporter_resultats_circonscriptions(engine: Engine, verbose: bool = False) -
|
||||
for voix_liste in resultats_circonscription.voix_listes:
|
||||
resultats_listes[voix_liste.liste.numero] = voix_liste.voix
|
||||
|
||||
file = DATA_DIR / "resultats" / "europeennes2024" / "circonscriptions" / f"{circonscription.id}.json"
|
||||
file = DATA_DIR / "resultats" / "europeennes2024" / "circonscription" / f"{circonscription.id}.json"
|
||||
if not file.parent.is_dir():
|
||||
file.parent.mkdir(parents=True)
|
||||
|
||||
@ -257,7 +258,7 @@ def exporter_resultats_circonscriptions(engine: Engine, verbose: bool = False) -
|
||||
|
||||
session.commit()
|
||||
|
||||
circonscriptions_file = DATA_DIR / "resultats" / "europeennes2024" / "circonscriptions" / "circonscriptions.json"
|
||||
circonscriptions_file = DATA_DIR / "resultats" / "europeennes2024" / "circonscription" / "circonscriptions.json"
|
||||
if not circonscriptions_file.parent.is_dir():
|
||||
circonscriptions_file.parent.mkdir(parents=True)
|
||||
|
||||
@ -302,7 +303,7 @@ def exporter_resultats_communes(engine: Engine, verbose: bool = False) -> None:
|
||||
for voix_liste in resultats_commune.voix_listes:
|
||||
resultats_listes[voix_liste.liste.numero] = voix_liste.voix
|
||||
|
||||
file = DATA_DIR / "resultats" / "europeennes2024" / "communes" / f"{commune.code_insee}.json"
|
||||
file = DATA_DIR / "resultats" / "europeennes2024" / "commune" / f"{commune.code_insee}.json"
|
||||
if not file.parent.is_dir():
|
||||
file.parent.mkdir(parents=True)
|
||||
|
||||
@ -311,7 +312,7 @@ def exporter_resultats_communes(engine: Engine, verbose: bool = False) -> None:
|
||||
|
||||
session.commit()
|
||||
|
||||
communes_file = DATA_DIR / "resultats" / "europeennes2024" / "communes" / "communes.json"
|
||||
communes_file = DATA_DIR / "resultats" / "europeennes2024" / "commune" / "communes.json"
|
||||
if not communes_file.parent.is_dir():
|
||||
communes_file.parent.mkdir(parents=True)
|
||||
|
||||
@ -357,7 +358,7 @@ def exporter_resultats_bureaux_vote(engine: Engine, verbose: bool = False) -> No
|
||||
for voix_liste in resultats_bureau_vote.voix_listes:
|
||||
resultats_listes[voix_liste.liste.numero] = voix_liste.voix
|
||||
|
||||
file = DATA_DIR / "resultats" / "europeennes2024" / "bureaux_vote" / f"{bureau_vote.id}.json"
|
||||
file = DATA_DIR / "resultats" / "europeennes2024" / "bureau_vote" / f"{bureau_vote.id}.json"
|
||||
if not file.parent.is_dir():
|
||||
file.parent.mkdir(parents=True)
|
||||
|
||||
@ -366,7 +367,7 @@ def exporter_resultats_bureaux_vote(engine: Engine, verbose: bool = False) -> No
|
||||
|
||||
session.commit()
|
||||
|
||||
bureaux_vote_file = DATA_DIR / "resultats" / "europeennes2024" / "bureaux_vote" / "bureaux_vote.json"
|
||||
bureaux_vote_file = DATA_DIR / "resultats" / "europeennes2024" / "bureau_vote" / "bureaux_vote.json"
|
||||
if not bureaux_vote_file.parent.is_dir():
|
||||
bureaux_vote_file.parent.mkdir(parents=True)
|
||||
|
||||
|
Reference in New Issue
Block a user