cambio en guardar el id del cuestionario en las
tablas de cuestionario
This commit is contained in:
@@ -57,6 +57,10 @@ const nuevo = async (body) => {
|
||||
throw new Error(messageByStatus[res.idStatus]); */
|
||||
// throw new Error('Id status no valido.'); // si no coincide con nada, error por defecto
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
let dataCuestionario = await Cuestionario.findOne({
|
||||
where: { idServicio, dirigidoA: 'programas' },
|
||||
});
|
||||
@@ -66,14 +70,9 @@ const nuevo = async (body) => {
|
||||
throw new Error('Ya existe un cuestionario para este servicio social');
|
||||
}
|
||||
|
||||
let respuestasRegistradas = await CuestionarioPrograma2.create({
|
||||
...body,
|
||||
});
|
||||
|
||||
console.log('despues de registrar cuestionario', respuestasRegistradas);
|
||||
|
||||
// si el cuestionario ya existe solo hay que actualizar el id de cuestionarioprograma o alumno
|
||||
|
||||
|
||||
let cuestionarioRegistro = await Cuestionario.create({
|
||||
idServicio,
|
||||
idCuestionarioPrograma: respuestasRegistradas.idCuestionarioPrograma,
|
||||
@@ -86,6 +85,21 @@ const nuevo = async (body) => {
|
||||
|
||||
console.log('cuestionario registrado', cuestionarioRegistro);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
let respuestasRegistradas = await CuestionarioPrograma2.create({
|
||||
...body,
|
||||
idCuestionario: cuestionarioRegistro.idCuestionario
|
||||
});
|
||||
|
||||
console.log('despues de registrar cuestionario', respuestasRegistradas);
|
||||
|
||||
// si el cuestionario ya existe solo hay que actualizar el id de cuestionarioprograma o alumno
|
||||
|
||||
|
||||
return cuestionarioRegistro;
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user