From 7185d97dde4599eb6710b788cf565b128afb496e Mon Sep 17 00:00:00 2001 From: aldoEMatamala <123381977+aldoEMatamala@users.noreply.github.com> Date: Tue, 29 Aug 2023 12:27:32 -0300 Subject: [PATCH] =?UTF-8?q?MAT=20-=20Filtros=20en=20gu=C3=ADa=20profesiona?= =?UTF-8?q?l=20(#1814)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(MAT-140):Filtros en guía profesional * fix(MAT-140):Filtros en guía profesional * fix(MAT): Vuleve a cargar filtro por profesional matriculado en guia profesional --------- Co-authored-by: aldoEMatamala Co-authored-by: silviroa --- core/tm/routes/profesional.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/core/tm/routes/profesional.ts b/core/tm/routes/profesional.ts index 787bac9c5e..2dd01c987e 100644 --- a/core/tm/routes/profesional.ts +++ b/core/tm/routes/profesional.ts @@ -170,6 +170,7 @@ router.get('/profesionales/exportSisa', Auth.authenticate(), async (req, res, ne router.get('/profesionales/guia', async (req, res, next) => { const opciones = {}; + opciones['profesionalMatriculado'] = true; if (req.query.documento) { opciones['documento'] = req.query.documento; } @@ -195,14 +196,12 @@ router.get('/profesionales/guia', async (req, res, next) => { } if (Object.keys(opciones).length) { - opciones['formacionGrado.matriculacion'] = { $ne: null }; - opciones['profesionalMatriculado'] = true; - const datosGuia: any = await Profesional.find(opciones); const resultado = []; - if (datosGuia.length > 0) { datosGuia.forEach(element => { + const formGradFilter = element.formacionGrado.filter(formGrado => formGrado.matriculacion !== null); + resultado.push({ id: element.id, nombre: element.nombre ? element.nombre : '', @@ -211,7 +210,7 @@ router.get('/profesionales/guia', async (req, res, next) => { documento: element.documento ? element.documento : '', cuit: element.cuit ? element.cuit : '', nacionalidad: element.nacionalidad ? element.nacionalidad.nombre : '', - profesiones: element.formacionGrado + profesiones: formGradFilter }); }); }