Skip to content

Commit

Permalink
fix(formations): mise à jour de l'ordre des millesimes des taux IJ (#509
Browse files Browse the repository at this point in the history
)
  • Loading branch information
gBusato authored Dec 17, 2024
1 parent 9c8a03e commit d08fc7b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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<TauxIJKey, TauxIJValue[]> = {
tauxPoursuite: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ 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,
});
}

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,
});
Expand Down

0 comments on commit d08fc7b

Please sign in to comment.