32 lines
987 B
JavaScript
32 lines
987 B
JavaScript
const moment = require('moment');
|
|
const { Op } = require('sequelize');
|
|
const helperPath = '../../helper';
|
|
const helper = require(`${helperPath}/helper`);
|
|
const encriptar = require(`${helperPath}/encriptar`);
|
|
const dbPath = '../../db/tablas';
|
|
const Carrera = require(`${dbPath}/Carrera`);
|
|
const CarreraHorario = require(`${dbPath}/CarreraHorario`);
|
|
const Grupo = require(`${dbPath}/Grupo`);
|
|
const Horario = require(`${dbPath}/Horario`);
|
|
const PrimerSemestre = require(`${dbPath}/PrimerSemestre`);
|
|
|
|
const get = async (body) => {
|
|
return CarreraHorario.findAll({
|
|
include: [{ model: Horario }, { model: Carrera }],
|
|
order: ['idHorario'],
|
|
}).then(async (res) => {
|
|
const data = [];
|
|
|
|
for (let i = 0; i < res.length; i++) {
|
|
const asistentes = await PrimerSemestre.findAll({
|
|
where: { idHorario: res[i].idHorario },
|
|
}).then((res) => res.length);
|
|
|
|
data.push({ CarreraHorario: res[i], asistentes });
|
|
}
|
|
return data;
|
|
});
|
|
};
|
|
|
|
module.exports = get;
|