fix: group resumen by factura+tipo only, not cedula
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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
ab2ef167f9
commit
6e9ee32646
+5
-2
@@ -219,7 +219,10 @@ async def resumen_page(
|
|||||||
|
|
||||||
rows = conn.execute(f"""
|
rows = conn.execute(f"""
|
||||||
SELECT
|
SELECT
|
||||||
factura, tipo, contrato, cedula, idrecepcion,
|
factura, tipo,
|
||||||
|
MAX(contrato) AS contrato,
|
||||||
|
MIN(cedula) AS cedula,
|
||||||
|
MAX(idrecepcion) AS idrecepcion,
|
||||||
COUNT(*) AS intentos,
|
COUNT(*) AS intentos,
|
||||||
SUM(CASE WHEN status != 'error' THEN 1 ELSE 0 END) AS exitos,
|
SUM(CASE WHEN status != 'error' THEN 1 ELSE 0 END) AS exitos,
|
||||||
MIN(created_at) AS primer_envio,
|
MIN(created_at) AS primer_envio,
|
||||||
@@ -232,7 +235,7 @@ async def resumen_page(
|
|||||||
END AS estado_final
|
END AS estado_final
|
||||||
FROM envios
|
FROM envios
|
||||||
WHERE DATE(created_at) = ? {where_extra}
|
WHERE DATE(created_at) = ? {where_extra}
|
||||||
GROUP BY factura, tipo, contrato, cedula, idrecepcion
|
GROUP BY factura, tipo
|
||||||
ORDER BY estado_final, tipo, factura
|
ORDER BY estado_final, tipo, factura
|
||||||
""", params_q).fetchall()
|
""", params_q).fetchall()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user