From 9e6f1171c62d411db056c142820b36250a5cefbe Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Tue, 28 Jul 2026 15:25:16 -0500 Subject: [PATCH] debug: show SQLite contratos excluir_ventas state in /debug-fb/cmxc Co-Authored-By: Claude Sonnet 4.6 --- app/routes/debug_fb.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app/routes/debug_fb.py b/app/routes/debug_fb.py index eaf76f4..f97bfb6 100644 --- a/app/routes/debug_fb.py +++ b/app/routes/debug_fb.py @@ -215,12 +215,31 @@ async def debug_cmxc( """, {"fi": fecha_ini, "ff": fecha_fin}) fb.disconnect() + + # Estado de contratos en SQLite (excluir_ventas) + conn2 = get_connection() + contratos_excluidos_vta = [ + r["numero_contrato"] + for r in conn2.execute( + "SELECT numero_contrato FROM contratos WHERE excluir_ventas=1 ORDER BY numero_contrato" + ).fetchall() + ] + contratos_activos_vta = [ + r["numero_contrato"] + for r in conn2.execute( + "SELECT numero_contrato FROM contratos WHERE excluir_ventas=0 ORDER BY numero_contrato" + ).fetchall() + ] + conn2.close() + return JSONResponse({ "ok": True, "fecha": fecha, "total_recepcion_del_dia": total[0]["N"] if ok2 and total else "?", "cmxc_count": len(rows or []), "cmxc_rows": list(rows or []), + "contratos_excluidos_ventas": contratos_excluidos_vta, + "contratos_activos_ventas": contratos_activos_vta, }) except Exception: return JSONResponse({"ok": False, "traceback": traceback.format_exc()})