From b3a7955a9d8f32f04b6834b1d804f3eb6258e731 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Sun, 9 Jun 2024 17:51:24 +0200 Subject: [PATCH] =?UTF-8?q?D=C3=A9placement=20des=20fichiers=20cache=20et?= =?UTF-8?q?=20donn=C3=A9es=20dans=20le=20r=C3=A9pertoire=20parent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Emmy D'Anello --- .gitignore | 2 ++ nupes-elections-front/src/Elections2024.js | 10 +++++----- nupes/cache.py | 2 +- nupes/scripts/export_resultats_2024.py | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index d8ecbd6..9e32054 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +.idea/ + __pycache__ .venv diff --git a/nupes-elections-front/src/Elections2024.js b/nupes-elections-front/src/Elections2024.js index f8196b3..4072d48 100644 --- a/nupes-elections-front/src/Elections2024.js +++ b/nupes-elections-front/src/Elections2024.js @@ -133,19 +133,19 @@ export default function Election2024({typeResultats = "france"}) { const [dataSieges, setDataSieges] = useState([]) useEffect(() => { - fetch("/nupes/data/resultats/europeennes2024/blocs.json").then(response => response.json()) + fetch("/data/resultats/europeennes2024/blocs.json").then(response => response.json()) .then(data => setBlocs(data)) - fetch("/nupes/data/resultats/europeennes2024/nuances.json").then(response => response.json()) + fetch("/data/resultats/europeennes2024/nuances.json").then(response => response.json()) .then(data => setNuances(data)) - fetch("/nupes/data/resultats/europeennes2024/listes.json").then(response => response.json()) + fetch("/data/resultats/europeennes2024/listes.json").then(response => response.json()) .then(data => setListes(data)) if (typeResultats === "france") { - fetch("/nupes/data/resultats/europeennes2024/france.json").then(response => response.json()) + fetch("/data/resultats/europeennes2024/france.json").then(response => response.json()) .then(data => setResultats(data)) } else { - fetch(`/nupes/data/resultats/europeennes2024/${typeResultats}/${zoneId}.json`).then(response => response.json()) + fetch(`/data/resultats/europeennes2024/${typeResultats}/${zoneId}.json`).then(response => response.json()) .then(data => setResultats(data)) } }, []) diff --git a/nupes/cache.py b/nupes/cache.py index 12c4351..0d6adca 100644 --- a/nupes/cache.py +++ b/nupes/cache.py @@ -3,7 +3,7 @@ from pathlib import Path import requests -CACHE_DIR = Path(__file__).parent / 'cache' +CACHE_DIR = Path(__file__).parent.parent / 'cache' def get_file(url, filename, force_etag: str = ""): diff --git a/nupes/scripts/export_resultats_2024.py b/nupes/scripts/export_resultats_2024.py index 1e26b16..37b2cbc 100644 --- a/nupes/scripts/export_resultats_2024.py +++ b/nupes/scripts/export_resultats_2024.py @@ -9,7 +9,7 @@ from nupes.models.geographie import Region, Departement, Commune from nupes.models.europeennes2024 import Bloc, Nuance, Liste, \ ResultatsFrance, ResultatsRegion, ResultatsDepartement, ResultatsCommune -DATA_DIR = Path(__file__).parent.parent / 'data' +DATA_DIR = Path(__file__).parent.parent.parent / 'data' def exporter_listes(engine: Engine, debug: bool = False) -> None: