Files
citas_recorridos_api/server/controller/PrimerSemestre/graficas.js
T
Lemuel Marquez fe0cd14820 tabla graph
2021-07-20 12:36:52 -05:00

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;