From 6181720839ded97afa993be955e9f3f90fc1349a Mon Sep 17 00:00:00 2001 From: Paul Gaucher Date: Fri, 20 Dec 2024 14:31:04 +0100 Subject: [PATCH] fix: mise a jour du filtre mission locale sur les niveaux --- server/src/common/actions/helpers/filters.ts | 2 +- .../common/actions/mission-locale/mission-locale.actions.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/common/actions/helpers/filters.ts b/server/src/common/actions/helpers/filters.ts index fe990b64e..341f1a168 100644 --- a/server/src/common/actions/helpers/filters.ts +++ b/server/src/common/actions/helpers/filters.ts @@ -82,7 +82,7 @@ export const effectifsFiltersMissionLocaleSchema = { .optional(), rqth: zBooleanStringSchema.optional(), mineur: zBooleanStringSchema.optional(), - niveau: z.array(z.string()).optional(), + niveaux: z.array(z.string()).optional(), code_insee: z.array(z.string()).optional(), }; diff --git a/server/src/common/actions/mission-locale/mission-locale.actions.ts b/server/src/common/actions/mission-locale/mission-locale.actions.ts index c51edfa0c..0aa1e57fa 100644 --- a/server/src/common/actions/mission-locale/mission-locale.actions.ts +++ b/server/src/common/actions/mission-locale/mission-locale.actions.ts @@ -20,7 +20,7 @@ export const EFF_MISSION_LOCALE_FILTER = [ ]; export const buildFiltersForMissionLocale = (effectifFilters: IEffectifsFiltersMissionLocale) => { - const { statut = null, rqth = null, mineur = null, niveau = null, code_insee = null } = effectifFilters; + const { statut = null, rqth = null, mineur = null, niveaux = null, code_insee = null } = effectifFilters; const filter = [ ...filterByDernierStatutPipeline( (statut as Array) ?? [ @@ -36,7 +36,7 @@ export const buildFiltersForMissionLocale = (effectifFilters: IEffectifsFiltersM ...(mineur !== null ? { "apprenant.date_de_naissance": { $gte: new Date(new Date().setFullYear(new Date().getFullYear() - 18)) } } : {}), - ...(niveau ? {} : {}), + ...(niveaux ? { "formation.niveau": { $in: niveaux } } : {}), ...(code_insee ? { "apprenant.adresse.code_insee": { $in: code_insee } } : {}), }, },