actualizacion en contar las asistencias
This commit is contained in:
+25
-7
@@ -9,15 +9,33 @@ app.get('/cupo', async(req, res) => {
|
||||
res.status(400).json({ err: true });
|
||||
return;
|
||||
}
|
||||
await results.forEach(element => {
|
||||
if (element.idConferencia == 7)
|
||||
arr.push([element.nombre, 'ilimitado', 100000 - element.capacidad]);
|
||||
else
|
||||
arr.push([element.nombre, 150, 150 - element.capacidad]);
|
||||
await results.forEach(async element => {
|
||||
if (element.idConferencia == 7) {
|
||||
await connection.query(`select count(asistencia) as asis from asistencia where idConferencia=7 and asistencia=1;`,
|
||||
(e, r, f) => {
|
||||
if (e) {
|
||||
res.status(400).json({ err: true, msj: "error al contar" });
|
||||
return;
|
||||
}
|
||||
arr.push([element.nombre, 'ilimitado', 100000 - element.capacidad, r[0].asis]);
|
||||
})
|
||||
|
||||
} else {
|
||||
await connection.query(`select count(asistencia) as asis from asistencia where idConferencia=${element.idConferencia} and asistencia=1;`,
|
||||
(e, r, f) => {
|
||||
if (e) {
|
||||
res.status(400).json({ err: true, msj: "error al contar" });
|
||||
return;
|
||||
}
|
||||
arr.push([element.nombre, 150, 150 - element.capacidad, r[0].asis]);
|
||||
if (element.idConferencia == 13) {
|
||||
res.status(200).json(arr);
|
||||
return;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
});
|
||||
res.status(200).json(arr);
|
||||
return;
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user