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 } } : {}), }, },