Affichage élections législatives 2022
This commit is contained in:
@ -31,7 +31,12 @@ def exporter_nuances(engine: Engine, verbose: bool = False) -> None:
|
||||
nuances_json = []
|
||||
|
||||
for nuance in nuances:
|
||||
nuance_json = {'code': nuance.code, 'nom': nuance.nom, 'couleur': nuance.couleur, "bloc": nuance.bloc_id}
|
||||
nuance_json = {
|
||||
'code': nuance.code,
|
||||
'nom': nuance.nom,
|
||||
'couleur': nuance.couleur,
|
||||
"bloc": nuance.bloc.nom,
|
||||
}
|
||||
nuances_json.append(nuance_json)
|
||||
|
||||
file = DATA_DIR / "resultats" / "legislatives" / "2022" / "nuances.json"
|
||||
@ -54,6 +59,7 @@ def exporter_candidats(engine: Engine, verbose: bool = False) -> None:
|
||||
candidat_json = {
|
||||
'numero': candidat.numero,
|
||||
'nuance': candidat.nuance_id,
|
||||
'bloc': candidat.nuance.bloc.nom,
|
||||
'nom': candidat.nom,
|
||||
'prenom': candidat.prenom,
|
||||
'nom_suppleance': candidat.nom_suppleance,
|
||||
@ -316,8 +322,8 @@ def exporter_resultats_circonscriptions(engine: Engine, verbose: bool = False) -
|
||||
resultats_dict['tour1']['voix'] = resultats_t1
|
||||
resultats_dict['tour2']['voix'] = resultats_t2
|
||||
for voix_candidat in resultats_circonscription.voix:
|
||||
resultats_t1[voix_candidat.candidat.id] = voix_candidat.voix_t1
|
||||
resultats_t2[voix_candidat.candidat.id] = voix_candidat.voix_t2
|
||||
resultats_t1[voix_candidat.candidat.numero] = voix_candidat.voix_t1
|
||||
resultats_t2[voix_candidat.candidat.numero] = voix_candidat.voix_t2
|
||||
|
||||
file = DATA_DIR / "resultats" / "legislatives" / "2022" / "circonscription" / f"{circonscription.id}.json"
|
||||
if not file.parent.is_dir():
|
||||
@ -457,8 +463,8 @@ def exporter_resultats_bureaux_vote(engine: Engine, verbose: bool = False) -> No
|
||||
resultats_dict['tour1']['voix'] = resultats_t1
|
||||
resultats_dict['tour2']['voix'] = resultats_t2
|
||||
for voix_candidat in resultats_bureau_vote.voix:
|
||||
resultats_t1[voix_candidat.candidat.id] = voix_candidat.voix_t1
|
||||
resultats_t2[voix_candidat.candidat.id] = voix_candidat.voix_t2
|
||||
resultats_t1[voix_candidat.candidat.numero] = voix_candidat.voix_t1
|
||||
resultats_t2[voix_candidat.candidat.numero] = voix_candidat.voix_t2
|
||||
|
||||
file = DATA_DIR / "resultats" / "legislatives" / "2022" / "bureau_vote" / f"{bureau_vote.id}.json"
|
||||
if not file.parent.is_dir():
|
||||
|
@ -33,7 +33,7 @@ def creer_blocs(engine: Engine, verbose: bool = False) -> None:
|
||||
def creer_nuances(engine: Engine, verbose: bool = False) -> None:
|
||||
nuances = [
|
||||
{"code": "DXG", "nom": "Divers extrême gauche", "couleur": "#BB0000", "bloc_id": 1},
|
||||
{"code": "RDG", "nom": "Radical de gauche", "couleur": "#FFD1DC", "bloc_id": 1},
|
||||
{"code": "RDG", "nom": "Parti radical de gauche", "couleur": "#FFD1DC", "bloc_id": 1},
|
||||
{"code": "NUP", "nom": "Nouvelle union populaire écologique et sociale", "couleur": "#E4032E", "bloc_id": 1},
|
||||
{"code": "DVG", "nom": "Divers gauche", "couleur": "#FFC0C0", "bloc_id": 1},
|
||||
{"code": "ECO", "nom": "Écologistes", "couleur": "#77FF77", "bloc_id": 5},
|
||||
|
Reference in New Issue
Block a user