tring to fix inscripcion

This commit is contained in:
2025-11-21 18:28:58 -06:00
parent 8b2266cb51
commit 35f0381af9
+15 -9
View File
@@ -45,25 +45,31 @@ export class OperationsService {
let newSaldo: number;
if (transaccion === 'Inscripcion') {
newSaldo = await this.personaService.saldo(idPersona);
const persona = await this.personaService.findById(idPersona);
const alumno = await this.alumnoService.findOneById(
Number(persona.numeroIdentificar),
);
if (!plataforma) {
throw new NotFoundException('Debe de colocar una plataforma');
}
const periodo = await this.periodoService.getLatestPeriodo();
const plataform = await this.plataformaService.getByName(plataforma);
const [saldoActual, persona, periodo, plataformaData] = await Promise.all(
[
this.personaService.saldo(idPersona),
this.personaService.findById(idPersona),
this.periodoService.getLatestPeriodo(),
this.plataformaService.getByName(plataforma),
],
);
const alumno = await this.alumnoService.findOneById(
Number(persona.numeroIdentificar),
);
await this.alumnoInscritoServie.create({
id_cuenta: alumno.id_cuenta,
id_periodo: periodo.id_periodo,
id_plataforma: plataform.id_plataforma,
id_plataforma: plataformaData.id_plataforma,
});
newSaldo = saldoActual;
} else {
newSaldo = await this.personaService.updateSaldo(idPersona, cantidad);
}