diff --git a/server/controller/Multa/historialMultasUsuario.js b/server/controller/Multa/historialMultasUsuario.js index 2e1d366..bf63549 100644 --- a/server/controller/Multa/historialMultasUsuario.js +++ b/server/controller/Multa/historialMultasUsuario.js @@ -18,24 +18,6 @@ const historialMultasUsuario = async (body) => { { model: Prestamo, where: { idUsuario }, - // include: [ - // { - // model: Equipo, - // include: [ - // { - // model: Carrito, - // include: [{ model: Modulo }, { model: TipoCarrito }], - // attributes: ['idCarrito', 'carrito'], - // }, - // ], - // attributes: [ - // 'idEquipo', - // 'numeroSerie', - // 'numeroInventario', - // 'equipo', - // ], - // }, - // ], attributes: ['idPrestamo'], }, { diff --git a/server/controller/Multa/multar.js b/server/controller/Multa/multar.js index a7be73f..7ee1250 100644 --- a/server/controller/Multa/multar.js +++ b/server/controller/Multa/multar.js @@ -42,7 +42,6 @@ const multar = async (body) => { }) .then((res) => { if (!res) throw new Error('No existe esta infracción.'); - // Checar si tiene una multa activa, agragar días a multa gravedad = res.gravedad; return Prestamo.findOne({ where: { idPrestamo }, diff --git a/server/controller/Prestamo/entregar.js b/server/controller/Prestamo/entregar.js index 21af501..b5b4ae3 100644 --- a/server/controller/Prestamo/entregar.js +++ b/server/controller/Prestamo/entregar.js @@ -50,10 +50,9 @@ const entregar = async (body) => { 'Ya pasó el tiempo límite para recoger el equipo de cómputo.' ); }); - // if (ahora > moment(`${ahora.format('YYYY-MM-DD')} 17:45`)) - // update.horaFin = moment(`${ahora.format('YYYY-MM-DD')} 19:45`); - // else update.horaFin = ahora.add(2, 'h').format(); - update.horaFin = ahora.add(2, 'h').format(); + if (ahora > moment(`${ahora.format('YYYY-MM-DD')} 17:45`)) + update.horaFin = moment(`${ahora.format('YYYY-MM-DD')} 19:45`); + else update.horaFin = ahora.add(2, 'h').format(); return Equipo.update({ idStatus: 2 }, { where: { idEquipo } }); }) .then(() => Prestamo.update(update, { where: { idPrestamo } })) diff --git a/server/controller/Prestamo/pedir.js b/server/controller/Prestamo/pedir.js index c5d6e0b..af1799a 100644 --- a/server/controller/Prestamo/pedir.js +++ b/server/controller/Prestamo/pedir.js @@ -30,14 +30,14 @@ const pedir = async (body) => { let whereEquipo = { idStatus: 4 }; let idEquipo; - // if (ahora.day() === 6 || ahora.day() === 0) - // throw new Error( - // 'No se puede pedir un equipo de cómputo los días sabados y domingos.' - // ); - // if (ahora > horaMax) - // throw new Error('Ya no se puede realizar un préstamo el día de hoy.'); - // if (ahora < horaMin) - // throw new Error('Aún es muy temprano para realizar un préstamo.'); + if (ahora.day() === 6 || ahora.day() === 0) + throw new Error( + 'No se puede pedir un equipo de cómputo los días sabados y domingos.' + ); + if (ahora > horaMax) + throw new Error('Ya no se puede realizar un préstamo el día de hoy.'); + if (ahora < horaMin) + throw new Error('Aún es muy temprano para realizar un préstamo.'); return TipoCarrito.findOne({ where: { idTipoCarrito } }) .then((res) => { if (!res) throw new Error('No existe este tipo de equipo.');