listo para mañana
This commit is contained in:
parent
d560314b71
commit
dddeae7783
@ -10,14 +10,14 @@ import { Socket, Server } from 'socket.io';
|
||||
@WebSocketGateway({
|
||||
cors: {
|
||||
origin: [
|
||||
// 'http://localhost:3176',
|
||||
// 'http://localhost:3186',
|
||||
'http://localhost:3176',
|
||||
'http://localhost:3186',
|
||||
// 'http://132.248.80.196:3155',
|
||||
// 'http://132.248.80.196:3185',
|
||||
// 'https://pmodulospcpuma.unam.mx',
|
||||
// 'https://pmodulospcpuma.unam.mx:3015',
|
||||
'https://modulospcpuma.unam.mx',
|
||||
'https://modulospcpuma.unam.mx:3015',
|
||||
// 'https://modulospcpuma.unam.mx',
|
||||
// 'https://modulospcpuma.unam.mx:3015',
|
||||
],
|
||||
},
|
||||
})
|
||||
|
@ -75,10 +75,7 @@ export class MultaService {
|
||||
// Si hay retraso lo agrego a la multa
|
||||
if (retraso) {
|
||||
nuevaMulta.retraso = true;
|
||||
fecha_fin.add(
|
||||
retraso * operadorMulta.institucion.dias_multa_retraso,
|
||||
'd',
|
||||
);
|
||||
fecha_fin.add(retraso * modulo.institucion.dias_multa_retraso, 'd');
|
||||
}
|
||||
fecha_fin.add(institucionInfraccion.dias_multa, 'd');
|
||||
nuevaMulta.fecha_fin = fecha_fin.toDate();
|
||||
|
@ -456,7 +456,7 @@ export class PrestamoController {
|
||||
const usuario: Usuario = req.user.usuario;
|
||||
|
||||
this.validarUsuarioService.validarUsuario(usuario);
|
||||
return this.prestamoService.prestamoInfoByUsuario(usuario);
|
||||
return this.prestamoService.prestamoInfoByUsuario(usuario, false);
|
||||
}
|
||||
|
||||
@Serealize(PrestamoEquipoOutputDto)
|
||||
|
@ -75,7 +75,7 @@ export class PrestamoService {
|
||||
motivo: string,
|
||||
modulo: Modulo,
|
||||
) {
|
||||
const ahora = moment();
|
||||
const ahora = moment().add(14, 'h');
|
||||
const prestamo = await this.findById(id_prestamo);
|
||||
|
||||
this.validacionBasicaPrestamo(prestamo);
|
||||
@ -104,7 +104,7 @@ export class PrestamoService {
|
||||
}
|
||||
|
||||
async cancelarUsuario(usuario: Usuario) {
|
||||
const ahora = moment();
|
||||
const ahora = moment().add(14, 'h');
|
||||
const prestamo = await this.prestamoInfoByUsuario(usuario);
|
||||
|
||||
this.validacionBasicaPrestamo(prestamo);
|
||||
@ -139,7 +139,7 @@ export class PrestamoService {
|
||||
id_programa?: number,
|
||||
id_tipo_entrada?: number,
|
||||
) {
|
||||
const ahora = moment();
|
||||
const ahora = moment().add(14, 'h');
|
||||
const ahoraStr = ahora.format('YYYY-MM-DD');
|
||||
const sistema = { id_operador: 1 };
|
||||
const modulo = await this.moduloService.findFullInfoById(id_modulo);
|
||||
@ -256,7 +256,7 @@ export class PrestamoService {
|
||||
}
|
||||
|
||||
async desactivarPrestamos() {
|
||||
const ahora = moment();
|
||||
const ahora = moment().add(14, 'h');
|
||||
|
||||
// Busco todos los préstamos activos y que esten apartadoss
|
||||
return this.informacionPrestamoView
|
||||
@ -294,7 +294,7 @@ export class PrestamoService {
|
||||
modulo: Modulo,
|
||||
id_prestamo: number,
|
||||
) {
|
||||
const ahora = moment();
|
||||
const ahora = moment().add(14, 'h');
|
||||
const ahoraStr = ahora.format('YYYY-MM-DD');
|
||||
const prestamo = await this.findById(id_prestamo);
|
||||
const institucionDia =
|
||||
@ -665,14 +665,17 @@ export class PrestamoService {
|
||||
});
|
||||
}
|
||||
|
||||
prestamoInfoByUsuario(usuario: Usuario) {
|
||||
prestamoInfoByUsuario(usuario: Usuario, validarExistencia = true) {
|
||||
return this.prestamoInformacionView
|
||||
.findOne({ where: { activo: 1, id_usuario: usuario.id_usuario } })
|
||||
.then((infoPrestamo) => {
|
||||
if (!infoPrestamo)
|
||||
throw new NotFoundException(
|
||||
'Este usuario no tiene un préstamo activo.',
|
||||
);
|
||||
if (!infoPrestamo) {
|
||||
if (validarExistencia)
|
||||
throw new NotFoundException(
|
||||
'Este usuario no tiene un préstamo activo.',
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
const prestamo = this.repository.create({
|
||||
id_prestamo: infoPrestamo.id_prestamo,
|
||||
@ -776,7 +779,7 @@ export class PrestamoService {
|
||||
descripcion?: string,
|
||||
id_institucion_infraccion?: number,
|
||||
) {
|
||||
const ahora = moment();
|
||||
const ahora = moment().add(14, 'h');
|
||||
// La resta ahora - hora_fin nos da la cantidad de tiempo que se paso el usuario
|
||||
// en entregar el equipo a tiempo. Si es negativa es que fue antes de la hora_fin
|
||||
const tardanza = Math.trunc(ahora.diff(moment(prestamo.hora_fin)) / 60000);
|
||||
|
Loading…
Reference in New Issue
Block a user