From e477aa2bea28d47ac97935af042b1abbd244a4a5 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Fri, 26 Jun 2026 19:25:33 -0500 Subject: [PATCH] Fix error display: show TNS response separately, default filter contrato=011 Co-Authored-By: Claude Sonnet 4.6 --- app/routes/test_rda.py | 12 +++++++++--- app/templates/test_rda.html | 20 ++++++++++++++------ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/app/routes/test_rda.py b/app/routes/test_rda.py index 88ef5ce..05d103b 100644 --- a/app/routes/test_rda.py +++ b/app/routes/test_rda.py @@ -234,13 +234,18 @@ async def test_enviar(request: Request, user: dict = Depends(get_current_user)): examenes = [r.get("COD_EXAMEN", "") for r in grupo_rows] try: r = await client.post(endpoint_rda, json=rda_json, headers=headers) + raw_resp = r.text try: data = r.json() - ok_rda = (data.get("status") or (data.get("data") or {}).get("success", False)) if isinstance(data, dict) else False - msg_rda = ((data.get("data") or {}).get("response") or data.get("message") or r.text[:200]) + ok_rda = bool(data.get("status") or (data.get("data") or {}).get("success", False)) if isinstance(data, dict) else False + msg_rda = ( + ((data.get("data") or {}).get("response")) + or data.get("message") + or raw_resp[:300] + ) except Exception: ok_rda = r.status_code < 300 - msg_rda = r.text[:200] + msg_rda = raw_resp[:300] pasos.append({ "tipo": "rda", "idrecepcion": id_rec, @@ -251,6 +256,7 @@ async def test_enviar(request: Request, user: dict = Depends(get_current_user)): "status": r.status_code, "ok": ok_rda, "mensaje": msg_rda, + "respuesta_tns": raw_resp, "json_enviado": rda_json, }) except Exception as ex: diff --git a/app/templates/test_rda.html b/app/templates/test_rda.html index ad71424..3a27f83 100644 --- a/app/templates/test_rda.html +++ b/app/templates/test_rda.html @@ -9,7 +9,7 @@

Candidatos disponibles

-
@@ -198,16 +201,21 @@ async function enviarRDA() { IDRECEPCION ${p.idrecepcion} · Factura ${p.factura} · Contrato ${p.contrato} + HTTP ${p.status || '?'}

Exámenes: ${(p.examenes || []).join(', ')}

-
- ${p.ok ? '✅' : '❌'} ${p.mensaje || '(sin mensaje)'} +
+ ${p.mensaje || '(sin mensaje de TNS)'}
- ${!p.ok ? `

HTTP ${p.status || '?'}

` : ''}
- +
+ + +
+
`; }