From 4936016e64e75bd1a678e8b425e8abe8bb4b7339 Mon Sep 17 00:00:00 2001 From: jerem Date: Fri, 13 Dec 2024 10:38:39 +0100 Subject: [PATCH] =?UTF-8?q?changement=20de=20l'ann=C3=A9e=20courante=20=3D?= =?UTF-8?q?>=202023-24?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/filieres-list/index.tsx | 3 ++- .../pages/atlas/charts/arrondissements-map/index.tsx | 3 ++- .../src/pages/atlas/components/atlas-map/index.tsx | 3 ++- .../pages/atlas/components/home-map-cards/index.tsx | 5 +++-- .../components/main/header/years-modal-button.tsx | 3 ++- .../pages/atlas/components/main/tabs/fields/all.tsx | 3 ++- .../src/pages/atlas/components/main/tabs/genders.tsx | 3 ++- .../src/pages/atlas/components/main/tabs/general.tsx | 3 ++- .../atlas/components/main/tabs/search/index.tsx | 3 ++- .../src/pages/atlas/components/main/tabs/sectors.tsx | 3 ++- .../pages/atlas/components/main/tabs/sub-list.tsx | 3 ++- client/src/pages/atlas/index.tsx | 3 ++- server/src/routes/tableaux/atlas/config.json | 2 +- server/src/routes/tableaux/atlas/index.js | 12 +++++++----- 14 files changed, 33 insertions(+), 19 deletions(-) diff --git a/client/src/components/filieres-list/index.tsx b/client/src/components/filieres-list/index.tsx index 9ae59ec6..fd1fdc68 100644 --- a/client/src/components/filieres-list/index.tsx +++ b/client/src/components/filieres-list/index.tsx @@ -4,13 +4,14 @@ import { Badge, Container, Row, Col, Text, Title } from "@dataesr/dsfr-plus"; import ListSkeleton from "../../pages/atlas/charts/skeletons/list.tsx"; import { getNumberOfStudents } from "../../api/atlas.ts"; +import { DEFAULT_CURRENT_YEAR } from "../../constants.tsx"; export default function FilieresList() { const [searchParams] = useSearchParams(); const params = [...searchParams] .map(([key, value]) => `${key}=${value}`) .join("&"); - const currentYear = searchParams.get("annee_universitaire") || "2022-23"; + const currentYear = searchParams.get("annee_universitaire") || DEFAULT_CURRENT_YEAR; const { data, isLoading } = useQuery({ queryKey: ["atlas/number-of-students", params], diff --git a/client/src/pages/atlas/charts/arrondissements-map/index.tsx b/client/src/pages/atlas/charts/arrondissements-map/index.tsx index c060cb77..2bad0d9e 100644 --- a/client/src/pages/atlas/charts/arrondissements-map/index.tsx +++ b/client/src/pages/atlas/charts/arrondissements-map/index.tsx @@ -7,6 +7,7 @@ import Template from "../../../../components/template"; import MapWithPolygonAndBubbles from "../map-with-polygon-and-bubbles"; import data from "./georef-france-commune-arrondissement-municipal@public.json"; import { MapBubbleDataProps } from "../../../../types/atlas"; +import { DEFAULT_CURRENT_YEAR } from "../../../../constants"; const config = { paris: { @@ -54,7 +55,7 @@ const config = { export default function ArrondissementsMap({ location }) { const [searchParams] = useSearchParams(); - const currentYear = searchParams.get("annee_universitaire") || "2022-23"; + const currentYear = searchParams.get("annee_universitaire") || DEFAULT_CURRENT_YEAR; const { data: dataHistoric, isLoading: isLoadingHistoric } = useQuery({ queryKey: [ diff --git a/client/src/pages/atlas/components/atlas-map/index.tsx b/client/src/pages/atlas/components/atlas-map/index.tsx index 4c1717e2..9fdaf383 100644 --- a/client/src/pages/atlas/components/atlas-map/index.tsx +++ b/client/src/pages/atlas/components/atlas-map/index.tsx @@ -18,6 +18,7 @@ import FilieresList from "../../../../components/filieres-list/index.tsx"; import SubList from "../main/tabs/sub-list.tsx"; import "./styles.scss"; +import { DEFAULT_CURRENT_YEAR } from "../../../../constants.tsx"; export default function AtlasMap() { const location = useLocation(); @@ -25,7 +26,7 @@ export default function AtlasMap() { const selectedTab = path[path.length - 1]; const [searchParams] = useSearchParams(); const geoId = searchParams.get("geo_id") || ""; - const currentYear = searchParams.get("annee_universitaire") || "2022-23"; + const currentYear = searchParams.get("annee_universitaire") || DEFAULT_CURRENT_YEAR; const { data: dataHistoric, isLoading: isLoadingHistoric } = useQuery({ queryKey: [ diff --git a/client/src/pages/atlas/components/home-map-cards/index.tsx b/client/src/pages/atlas/components/home-map-cards/index.tsx index 7d00071a..290e9e95 100644 --- a/client/src/pages/atlas/components/home-map-cards/index.tsx +++ b/client/src/pages/atlas/components/home-map-cards/index.tsx @@ -12,6 +12,7 @@ type TerritoiresListProps = { }; import { GetLevelBadgeFromId } from "../../utils/badges.tsx"; +import { DEFAULT_CURRENT_YEAR } from "../../../../constants.tsx"; function getRandomElementsFromArray( territoiresList: TerritoiresListProps[], @@ -74,7 +75,7 @@ export default function HomeMapCards({
  • - + France {GetLevelBadgeFromId({ id: "PAYS_100" })} @@ -87,7 +88,7 @@ export default function HomeMapCards({ style={{ borderBottom: "solid 1px #ddd" }} > {territoire.label} diff --git a/client/src/pages/atlas/components/main/header/years-modal-button.tsx b/client/src/pages/atlas/components/main/header/years-modal-button.tsx index ff9c943b..e349d89d 100644 --- a/client/src/pages/atlas/components/main/header/years-modal-button.tsx +++ b/client/src/pages/atlas/components/main/header/years-modal-button.tsx @@ -4,11 +4,12 @@ import { useQuery } from '@tanstack/react-query'; import { Alert, Button, Modal, ModalContent, ModalTitle } from '@dataesr/dsfr-plus'; import { getFiltersValues } from '../../../../../api/atlas.ts'; +import { DEFAULT_CURRENT_YEAR } from '../../../../../constants.tsx'; export default function YearsModalButton() { const [isOpen, setIsOpen] = useState(false); const [searchParams] = useSearchParams(); - const currentYear = searchParams.get('annee_universitaire') || '2022-23'; + const currentYear = searchParams.get('annee_universitaire') || DEFAULT_CURRENT_YEAR; const geoId = searchParams.get('geo_id') || ''; const [showAlertMessage, setShowAlertMessage] = useState(false); diff --git a/client/src/pages/atlas/components/main/tabs/fields/all.tsx b/client/src/pages/atlas/components/main/tabs/fields/all.tsx index 4719e2da..87e9c92f 100644 --- a/client/src/pages/atlas/components/main/tabs/fields/all.tsx +++ b/client/src/pages/atlas/components/main/tabs/fields/all.tsx @@ -10,10 +10,11 @@ import { import FilieresGendersChart from "../../../../charts/filieres-genders.tsx"; import FilieresList from "../../../../../../components/filieres-list/index.tsx"; +import { DEFAULT_CURRENT_YEAR } from "../../../../../../constants.tsx"; export default function AllFields() { const [searchParams] = useSearchParams(); - const currentYear = searchParams.get("annee_universitaire") || "2022-23"; + const currentYear = searchParams.get("annee_universitaire") || DEFAULT_CURRENT_YEAR; const params = [...searchParams] .map(([key, value]) => `${key}=${value}`) .join("&"); diff --git a/client/src/pages/atlas/components/main/tabs/genders.tsx b/client/src/pages/atlas/components/main/tabs/genders.tsx index f72406e5..d5bd338a 100644 --- a/client/src/pages/atlas/components/main/tabs/genders.tsx +++ b/client/src/pages/atlas/components/main/tabs/genders.tsx @@ -24,12 +24,13 @@ import { import GenderHistoChart from "../../../charts/genders-histo.tsx"; import { DataByYear, SimilarData } from "../../../../../types/atlas.ts"; import StudentsCardWithTrend from "../../../../../components/cards/students-card-with-trend/index.tsx"; +import { DEFAULT_CURRENT_YEAR } from "../../../../../constants.tsx"; export function Genders() { const [chartView, setChartView] = useState<"basic" | "percentage">("basic"); const [chartType, setChartType] = useState<"column" | "line">("column"); const [searchParams] = useSearchParams(); - const currentYear = searchParams.get("annee_universitaire") || "2022-23"; + const currentYear = searchParams.get("annee_universitaire") || DEFAULT_CURRENT_YEAR; const geoId = searchParams.get("geo_id") || ""; const params = [...searchParams] .map(([key, value]) => `${key}=${value}`) diff --git a/client/src/pages/atlas/components/main/tabs/general.tsx b/client/src/pages/atlas/components/main/tabs/general.tsx index 4c3d070d..0161c16c 100644 --- a/client/src/pages/atlas/components/main/tabs/general.tsx +++ b/client/src/pages/atlas/components/main/tabs/general.tsx @@ -30,13 +30,14 @@ import MapSkeleton from "../../../charts/skeletons/map.tsx"; import ArrondissementsMap from "../../../charts/arrondissements-map/index.tsx"; import "./styles.scss"; +import { DEFAULT_CURRENT_YEAR } from "../../../../../constants.tsx"; export function General() { const [searchParams] = useSearchParams(); const params = [...searchParams] .map(([key, value]) => `${key}=${value}`) .join("&"); - const currentYear = searchParams.get("annee_universitaire") || "2022-23"; + const currentYear = searchParams.get("annee_universitaire") || DEFAULT_CURRENT_YEAR; const geoId = searchParams.get("geo_id") || ""; const { data, isLoading } = useQuery({ diff --git a/client/src/pages/atlas/components/main/tabs/search/index.tsx b/client/src/pages/atlas/components/main/tabs/search/index.tsx index 751b19d8..e2c94921 100644 --- a/client/src/pages/atlas/components/main/tabs/search/index.tsx +++ b/client/src/pages/atlas/components/main/tabs/search/index.tsx @@ -19,6 +19,7 @@ import HomeMapCards from "../../../home-map-cards/index.js"; import { GetLevelBadgeFromItem } from "../../../../utils/badges.js"; import "./styles.scss"; +import { DEFAULT_CURRENT_YEAR } from "../../../../../../constants.js"; type SearchTypes = { geo_id: string; @@ -195,7 +196,7 @@ export function Search() { key={result.geo_id} onClick={() => { navigate( - `/atlas/general?geo_id=${result.geo_id}&annee_universitaire=2022-23` + `/atlas/general?geo_id=${result.geo_id}&annee_universitaire=${DEFAULT_CURRENT_YEAR}` ); }} > diff --git a/client/src/pages/atlas/components/main/tabs/sectors.tsx b/client/src/pages/atlas/components/main/tabs/sectors.tsx index f8067356..4f891153 100644 --- a/client/src/pages/atlas/components/main/tabs/sectors.tsx +++ b/client/src/pages/atlas/components/main/tabs/sectors.tsx @@ -24,12 +24,13 @@ import { } from "../../../../../api/atlas.ts"; import { DataByYear, SimilarData } from "../../../../../types/atlas.ts"; import StudentsCardWithTrend from "../../../../../components/cards/students-card-with-trend/index.tsx"; +import { DEFAULT_CURRENT_YEAR } from "../../../../../constants.tsx"; export function Sectors() { const [chartView, setChartView] = useState<"basic" | "percentage">("basic"); const [chartType, setChartType] = useState<"column" | "line">("column"); const [searchParams] = useSearchParams(); - const currentYear = searchParams.get("annee_universitaire") || "2022-23"; + const currentYear = searchParams.get("annee_universitaire") || DEFAULT_CURRENT_YEAR; const geoId = searchParams.get("geo_id") || ""; const params = [...searchParams] .map(([key, value]) => `${key}=${value}`) diff --git a/client/src/pages/atlas/components/main/tabs/sub-list.tsx b/client/src/pages/atlas/components/main/tabs/sub-list.tsx index 0eef4618..8d9568fe 100644 --- a/client/src/pages/atlas/components/main/tabs/sub-list.tsx +++ b/client/src/pages/atlas/components/main/tabs/sub-list.tsx @@ -4,12 +4,13 @@ import { useQuery } from "@tanstack/react-query"; import Template from "../../../../../components/template/index.tsx"; import { getNumberOfStudentsHistoricByLevel } from "../../../../../api/index.ts"; +import { DEFAULT_CURRENT_YEAR } from "../../../../../constants.tsx"; export default function SubList() { const [searchParams] = useSearchParams(); const navigate = useNavigate(); const geoId = searchParams.get("geo_id") || ""; - const currentYear = searchParams.get("annee_universitaire") || "2022-23"; + const currentYear = searchParams.get("annee_universitaire") || DEFAULT_CURRENT_YEAR; const { data: dataHistoric, isLoading: isLoadingHistoric } = useQuery({ queryKey: [ diff --git a/client/src/pages/atlas/index.tsx b/client/src/pages/atlas/index.tsx index 37d40031..cb264a75 100644 --- a/client/src/pages/atlas/index.tsx +++ b/client/src/pages/atlas/index.tsx @@ -23,11 +23,12 @@ import { AtlasSideMenu } from "./side-menu-layout/index.tsx"; import { GetLevelBadgeFromId } from "./utils/badges.tsx"; import "./styles.scss"; +import { DEFAULT_CURRENT_YEAR } from "../../constants.tsx"; export default function AtlasHeader() { const [searchParams] = useSearchParams(); const geoId = searchParams.get("geo_id") || ""; - const currentYear = searchParams.get("annee_universitaire") || "2022-23"; + const currentYear = searchParams.get("annee_universitaire") || DEFAULT_CURRENT_YEAR; const navigate = useNavigate(); useTitle("dataSupR - Atlas des effectifs étudiant-e-s"); diff --git a/server/src/routes/tableaux/atlas/config.json b/server/src/routes/tableaux/atlas/config.json index d1b21e57..9a082c1c 100644 --- a/server/src/routes/tableaux/atlas/config.json +++ b/server/src/routes/tableaux/atlas/config.json @@ -1,7 +1,7 @@ { "label": "Atlas des effectifs étudiants", "description": "Description de l'atlas des effectifs étudiants", - "constants": [{ "current_year": "2022-23" }], + "constants": [{ "current_year": "2023-24" }], "data": [ { "key": "atlas", diff --git a/server/src/routes/tableaux/atlas/index.js b/server/src/routes/tableaux/atlas/index.js index b6b9b803..23565322 100644 --- a/server/src/routes/tableaux/atlas/index.js +++ b/server/src/routes/tableaux/atlas/index.js @@ -42,6 +42,8 @@ const filieresOrder = [ "TOTAL", ]; +const DEFAULT_CURRENT_YEAR = "2023-24"; + router.route("/atlas/get-geo-ids-from-search").get((req, res) => { if ( (!req.query.q || req.query?.q.length === 0) && @@ -413,7 +415,7 @@ router.route("/atlas/number-of-students-historic-by-level").get(async (req, res) router.route("/atlas/number-of-students-by-gender-and-level").get(async (req, res) => { const filters = { ...req.query }; if (!req.query.annee_universitaire) { - filters.annee_universitaire = "2022-23"; + filters.annee_universitaire = DEFAULT_CURRENT_YEAR; } const data = await db .collection("atlas2024") @@ -480,7 +482,7 @@ router.route("/atlas/number-of-students-by-gender-and-level").get(async (req, re router.route("/atlas/number-of-students-by-sector-and-sublevel").get(async (req, res) => { const filters = { ...req.query }; if (!req.query.annee_universitaire) { - filters.annee_universitaire = "2022-23"; + filters.annee_universitaire = DEFAULT_CURRENT_YEAR; } filters.regroupement = "TOTAL"; @@ -538,7 +540,7 @@ router.route("/atlas/number-of-students-by-sector-and-sublevel").get(async (req, router.route("/atlas/number-of-students-by-gender-and-sublevel").get(async (req, res) => { const filters = { ...req.query }; if (!req.query.annee_universitaire) { - filters.annee_universitaire = "2022-23"; + filters.annee_universitaire = DEFAULT_CURRENT_YEAR; } const data = await db @@ -595,7 +597,7 @@ router.route("/atlas/number-of-students-by-gender-and-sublevel").get(async (req, router.route("/atlas/number-of-students-by-field-and-sublevel").get(async (req, res) => { const filters = { ...req.query }; if (!req.query.annee_universitaire) { - filters.annee_universitaire = "2022-23"; + filters.annee_universitaire = DEFAULT_CURRENT_YEAR; } const data = await db @@ -642,7 +644,7 @@ router.route("/atlas/number-of-students-by-field-and-sublevel").get(async (req, router.route("/atlas/number-of-students").get((req, res) => { const filters = { ...req.query }; if (!req.query.annee_universitaire) { - filters.annee_universitaire = "2022-23"; + filters.annee_universitaire = DEFAULT_CURRENT_YEAR; } if (!req.query.geo_id) {