cambio de variables bool de la tabla cuestionario alumno, agregar data del cuestionario alumno

This commit is contained in:
eithan
2021-01-02 17:09:06 -06:00
parent 1ce52851bc
commit 8b41a19f55
3 changed files with 108 additions and 54 deletions
+81 -27
View File
@@ -4,42 +4,96 @@ const Servicio = require('../../db/tablas/Servicio');
const nuevo = async (body) => {
let idServicio = validar.validarId(body.idServicio);
let sexo = '';
let edad = '';
let servicioMedico = '';
let pUno = '';
let pDos = '';
let sexo = body.asnwers.sexo;
let edad = body.asnwers.edad;
let servicioMedico = body.asnwers.servicioMedico;
let pUno = body.asnwers.p1;
let pDos = body.asnwers.p2;
let pCuatro = body.asnwers.p4;
let pSeis = body.asnwers.p6;
let pSiete = body.asnwers.p7;
let pNueve = body.asnwers.p9;
let pDiez = body.asnwers.p10;
let pOnce = body.asnwers.p11;
let pDoce = body.asnwers.p12;
let pTrece = body.asnwers.p13;
let pDieciseis = body.asnwers.p16;
let pDieciocho = body.asnwers.p18;
let pDiecinueve = body.asnwers.p19;
let pVeinte = body.asnwers.p20;
let pVeinticinco = body.asnwers.p25;
let pVeintiseis = body.asnwers.p26;
let pVeintisiete = body.asnwers.p27;
let pVeintiocho = body.asnwers.p28;
let pVeintinueve = body.asnwers.p29;
let pTreinta = body.asnwers.p30;
//strings
let pTres = '';
let pCuatro = '';
let pCinco = '';
let pSeis = '';
let pSiete = '';
let pOcho = '';
let pNueve = '';
let pDiez = '';
let pOnce = '';
let pDoce = '';
let pTrece = '';
let pCinco ='';
let pOcho ='';
let pCatorce = '';
let pQuince = '';
let pDieciseis = '';
let pDiecisiete = '';
let pDieciocho = '';
let pDiecinueve = '';
let pVeinte = '';
let pVeintiuno = '';
let pVeintidos = '';
let pVeintitres = '';
let pVeinticuatro = '';
let pVeinticinco = '';
let pVeintiseis = '';
let pVeintisiete = '';
let pVeintiocho = '';
let pVeintinueve = '';
let pTreinta = '';
for(let i= 0 ; i < body.asnwers.p3.length ; i++){
pTres += body.asnwers.p3[i]
if(i < body.asnwers.p3.length -1) pTres += ','
}
for(let i= 0 ; i < body.asnwers.p5.length ; i++){
pCinco += body.asnwers.p5[i]
if(i < body.asnwers.p5.length -1) pCinco += ','
}
for(let i= 0 ; i < body.asnwers.p8.length ; i++){
pOcho += body.asnwers.p8[i]
if(i < body.asnwers.p8.length -1) pOcho += ','
}
for(let i= 0 ; i < body.asnwers.p14.length ; i++){
pCatorce += body.asnwers.p14[i]
if(i < body.asnwers.p14.length -1) pCatorce += ','
}
for(let i= 0 ; i < body.asnwers.p15.length ; i++){
pQuince += body.asnwers.p15[i]
if(i < body.asnwers.p15.length -1) pQuince += ','
}
for(let i= 0 ; i < body.asnwers.p17.length ; i++){
pDiecisiete += body.asnwers.p17[i]
if(i < body.asnwers.p17.length -1) pDiecisiete += ','
}
for(let i= 0 ; i < body.asnwers.p21.length ; i++){
pVeintiuno += body.asnwers.p21[i]
if(i < body.asnwers.p21.length -1) pVeintiuno += ','
}
for(let i= 0 ; i < body.asnwers.p22.length ; i++){
pVeintidos += body.asnwers.p22[i]
if(i < body.asnwers.p22.length -1) pVeintidos += ','
}
for(let i= 0 ; i < body.asnwers.p23.length ; i++){
pVeintitres += body.asnwers.p23[i]
if(i < body.asnwers.p23.length -1) pVeintitres += ','
}
for(let i= 0 ; i < body.asnwers.p24.length ; i++){
pVeinticuatro += body.asnwers.p24[i]
if(i < body.asnwers.p24.length -1) pVeinticuatro += ','
}
console.log(body.asnwers.p5)
console.log(pCinco)
return Servicio.findOne({ where: { idServicio } })
return Servicio.findOne({ where: { idServicio } })
.then((res) => {
if (!res) throw new Error('No existe este Servicio Social.');
if (res.idCuestionarioAlumno)