From 6e9ee3264632eb3bc6d4b0f738cb04585df0b513 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Sun, 26 Jul 2026 18:09:42 -0500 Subject: [PATCH] fix: group resumen by factura+tipo only, not cedula MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Grouping by cedula caused envíos with null/different cedula to split into separate groups, making success envíos invisible — factura 4989 showed error persistente despite having a success send. Co-Authored-By: Claude Sonnet 4.6 --- app/routes/logs.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/routes/logs.py b/app/routes/logs.py index 8d987a9..b7457d1 100644 --- a/app/routes/logs.py +++ b/app/routes/logs.py @@ -219,7 +219,10 @@ async def resumen_page( rows = conn.execute(f""" SELECT - factura, tipo, contrato, cedula, idrecepcion, + factura, tipo, + MAX(contrato) AS contrato, + MIN(cedula) AS cedula, + MAX(idrecepcion) AS idrecepcion, COUNT(*) AS intentos, SUM(CASE WHEN status != 'error' THEN 1 ELSE 0 END) AS exitos, MIN(created_at) AS primer_envio, @@ -232,7 +235,7 @@ async def resumen_page( END AS estado_final FROM envios WHERE DATE(created_at) = ? {where_extra} - GROUP BY factura, tipo, contrato, cedula, idrecepcion + GROUP BY factura, tipo ORDER BY estado_final, tipo, factura """, params_q).fetchall()