debug: show SQLite contratos excluir_ventas state in /debug-fb/cmxc
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
27b15b184c
commit
9e6f1171c6
@@ -215,12 +215,31 @@ async def debug_cmxc(
|
|||||||
""", {"fi": fecha_ini, "ff": fecha_fin})
|
""", {"fi": fecha_ini, "ff": fecha_fin})
|
||||||
|
|
||||||
fb.disconnect()
|
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({
|
return JSONResponse({
|
||||||
"ok": True,
|
"ok": True,
|
||||||
"fecha": fecha,
|
"fecha": fecha,
|
||||||
"total_recepcion_del_dia": total[0]["N"] if ok2 and total else "?",
|
"total_recepcion_del_dia": total[0]["N"] if ok2 and total else "?",
|
||||||
"cmxc_count": len(rows or []),
|
"cmxc_count": len(rows or []),
|
||||||
"cmxc_rows": list(rows or []),
|
"cmxc_rows": list(rows or []),
|
||||||
|
"contratos_excluidos_ventas": contratos_excluidos_vta,
|
||||||
|
"contratos_activos_ventas": contratos_activos_vta,
|
||||||
})
|
})
|
||||||
except Exception:
|
except Exception:
|
||||||
return JSONResponse({"ok": False, "traceback": traceback.format_exc()})
|
return JSONResponse({"ok": False, "traceback": traceback.format_exc()})
|
||||||
|
|||||||
Reference in New Issue
Block a user