Refactor respuesta validation in submitRespuestas method for improved clarity
This commit is contained in:
@@ -87,7 +87,9 @@ export class CuestionarioRespondidoService {
|
||||
if (cuestionario.evento?.id_evento) {
|
||||
const id_evento = cuestionario.evento.id_evento;
|
||||
const tieneLista =
|
||||
await this.eventoUsuarioService.eventoTieneListaRestringida(id_evento);
|
||||
await this.eventoUsuarioService.eventoTieneListaRestringida(
|
||||
id_evento,
|
||||
);
|
||||
|
||||
if (tieneLista) {
|
||||
const preguntaIds = submitDto.respuestas.map((r) => r.id_pregunta);
|
||||
@@ -109,13 +111,17 @@ export class CuestionarioRespondidoService {
|
||||
const respuesta = submitDto.respuestas.find(
|
||||
(r) => r.id_pregunta === pregunta.id_pregunta,
|
||||
);
|
||||
|
||||
if (
|
||||
respuesta &&
|
||||
typeof respuesta.valor === 'string' &&
|
||||
respuesta.valor.trim()
|
||||
respuesta.valor !== null &&
|
||||
respuesta.valor !== undefined
|
||||
) {
|
||||
identificador = respuesta.valor.trim().toUpperCase();
|
||||
break;
|
||||
const valorStr = String(respuesta.valor).trim();
|
||||
if (valorStr) {
|
||||
identificador = valorStr.toUpperCase();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user