Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion core/tm/controller/profesional.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,12 @@ export async function search(filter, fields) {
return await Profesional.aggregate(aggregate);
}

export async function searchMatriculas(profesionalId) {
export async function searchMatriculas(profesionalId, incluirVencidas = false) {
const _profesional: any = await Profesional.findById(profesionalId);
const filterFormaciones = (e) => {
if (incluirVencidas) {
return e.matriculacion && e.matriculacion.length;
}
return e.matriculacion && e.matriculacion.length && !e.matriculacion[e.matriculacion.length - 1].baja.fecha && moment(e.matriculacion[e.matriculacion.length - 1].fin).isAfter(new Date());
};

Expand Down
3 changes: 2 additions & 1 deletion modules/recetas/recetasController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,9 @@ export async function getProfesionActualizada(idProfesional) {
let profesionGrado = '';
let matriculaGrado = 0;
let especialidades = '';
const incluirVencidas = true;

const infoMatriculas = await searchMatriculas(idProfesional);
const infoMatriculas = await searchMatriculas(idProfesional, incluirVencidas);

if (infoMatriculas) {
// Los codigos de los roles permitidos son los de las profesiones: Médico, Odontólogo y Obstetra respectivamente.
Expand Down