From ae770a499834d0d68ecacf7f6d2d16ea307db13f Mon Sep 17 00:00:00 2001 From: lemuel Date: Mon, 17 Apr 2023 23:32:31 -0600 Subject: [PATCH] mejoras --- src/prestamo/prestamo.service.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/prestamo/prestamo.service.ts b/src/prestamo/prestamo.service.ts index 0a7854a..c441966 100644 --- a/src/prestamo/prestamo.service.ts +++ b/src/prestamo/prestamo.service.ts @@ -163,6 +163,9 @@ export class PrestamoService { id_tipo_entrada?: number, ): Promise { const ahora = moment(); + + if (this.add) ahora.add(this.add, 'h'); + const ahoraStr = ahora.format('YYYY-MM-DD'); const modulo = await this.moduloService.findFullInfoById(id_modulo); const tipoCarrito = @@ -190,7 +193,6 @@ export class PrestamoService { ) : null; - if (this.add) ahora.add(this.add, 'h'); // Validamos que el id_institucion_usuario le pertenezca al usuario if (institucionUsuario.usuario.id_usuario != usuario.id_usuario) throw new ConflictException('No te pertenece esta información.'); @@ -288,6 +290,9 @@ export class PrestamoService { id_prestamo: number | Prestamo, ): Promise { const ahora = moment(); + + if (this.add) ahora.add(this.add, 'h'); + const ahoraStr = ahora.format('YYYY-MM-DD'); const prestamo = typeof id_prestamo === 'number' @@ -303,7 +308,6 @@ export class PrestamoService { ? moment(`${ahoraStr} ${institucionDia.hora_fin}`) : null; - if (this.add) ahora.add(this.add, 'h'); if ( prestamo.equipo.carrito.tipoCarrito.id_tipo_carrito != 4 && prestamo.equipo.carrito.tipoCarrito.id_tipo_carrito != 5