Skip to content

Commit

Permalink
MAT - Filtros en guía profesional (#1814)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: silviroa <[email protected]>
  • Loading branch information
3 people authored Aug 29, 2023
1 parent 401acfb commit 7185d97
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions core/tm/routes/profesional.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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 : '',
Expand All @@ -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
});
});
}
Expand Down

0 comments on commit 7185d97

Please sign in to comment.