From d08fc7bfb31836075bea964b0138a460958e90f8 Mon Sep 17 00:00:00 2001 From: Gaetan BUSATO Date: Tue, 17 Dec 2024 11:56:01 +0100 Subject: [PATCH] =?UTF-8?q?fix(formations):=20mise=20=C3=A0=20jour=20de=20?= =?UTF-8?q?l'ordre=20des=20millesimes=20des=20taux=20IJ=20(#509)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dependencies/getTauxIJ.dep.ts | 13 ++++++++++++- .../Tabs/IndicateursTab/DevenirBarGraph.tsx | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/server/src/modules/data/usecases/getFormationIndicateurs/dependencies/getTauxIJ.dep.ts b/server/src/modules/data/usecases/getFormationIndicateurs/dependencies/getTauxIJ.dep.ts index bd311c86d..1b9cbb699 100644 --- a/server/src/modules/data/usecases/getFormationIndicateurs/dependencies/getTauxIJ.dep.ts +++ b/server/src/modules/data/usecases/getFormationIndicateurs/dependencies/getTauxIJ.dep.ts @@ -8,6 +8,16 @@ import { selectTauxInsertion6moisAgg } from "@/modules/data/utils/tauxInsertion6 import { selectTauxPoursuiteAgg } from "@/modules/data/utils/tauxPoursuite"; import { cleanNull } from "@/utils/noNull"; +function listUniqMillesimes( + indicateurs: { + millesimeSortie: string | null; + }[] +) { + return _.uniq(indicateurs.filter((i) => i.millesimeSortie).map((i) => i.millesimeSortie as string)).sort((a, z) => + a.localeCompare(z) + ); +} + export const getTauxIJ = async ({ cfd, codeRegion }: { cfd: string; codeRegion?: string }) => { const indicateursIJ = await getKbdClient() .selectFrom("formationView as formation") @@ -40,9 +50,10 @@ export const getTauxIJ = async ({ cfd, codeRegion }: { cfd: string; codeRegion?: "formation.libelleFormation", "indicateurRegionSortie.millesimeSortie", ]) + .orderBy("indicateurRegionSortie.millesimeSortie", "asc") .execute(); - const millesimes = _.uniq(indicateursIJ.filter((i) => i.millesimeSortie).map((i) => i.millesimeSortie as string)); + const millesimes = listUniqMillesimes(indicateursIJ); const tauxIJ: Record = { tauxPoursuite: [], diff --git a/ui/app/(wrapped)/domaine-de-formation/[codeNsf]/components/FormationSection/Tabs/IndicateursTab/DevenirBarGraph.tsx b/ui/app/(wrapped)/domaine-de-formation/[codeNsf]/components/FormationSection/Tabs/IndicateursTab/DevenirBarGraph.tsx index ebb5c2538..834241387 100644 --- a/ui/app/(wrapped)/domaine-de-formation/[codeNsf]/components/FormationSection/Tabs/IndicateursTab/DevenirBarGraph.tsx +++ b/ui/app/(wrapped)/domaine-de-formation/[codeNsf]/components/FormationSection/Tabs/IndicateursTab/DevenirBarGraph.tsx @@ -40,7 +40,7 @@ export const DevenirBarGraph = function ({ if (hasVoieScolaire) { series.push({ - name: `Voie scolaire ${datas.some((d) => d.scolaire !== undefined) ? "" : "(indisponible)"}`, + name: `Voie scolaire${datas.some((d) => d.scolaire !== undefined) ? "" : " (indisponible)"}`, data: datas.map((data) => data.scolaire), color: blue, }); @@ -48,7 +48,7 @@ export const DevenirBarGraph = function ({ if (hasVoieApprentissage) { series.push({ - name: `Apprentissage ${datas.some((d) => d.apprentissage !== undefined) ? "" : "(indisponible)"}`, + name: `Apprentissage${datas.some((d) => d.apprentissage !== undefined) ? "" : " (indisponible)"}`, data: datas.map((data) => data.apprentissage), color: mustard, });