fix(automation): guardar mensaje_tns en _guardar_envio; eliminar script tmp

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-22 23:01:27 -05:00
co-authored by Claude Sonnet 4.6
parent 36ace04c35
commit 66d44392ee
2 changed files with 3 additions and 24 deletions
+3 -2
View File
@@ -797,8 +797,8 @@ def _guardar_envio(user_id, tipo, factura, json_data, respuesta, ok,
conn.execute("""
INSERT INTO envios (user_id, tipo, factura, idrecepcion, contrato, cedula,
fecha_inicio, fecha_fin,
pacientes_count, servicios_count, status, json_enviado, respuesta_api, created_at)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
pacientes_count, servicios_count, status, json_enviado, respuesta_api, mensaje_tns, created_at)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""", (
user_id, tipo, factura, idrecepcion, contrato, cedula,
fecha_inicio, fecha_fin,
@@ -806,6 +806,7 @@ def _guardar_envio(user_id, tipo, factura, json_data, respuesta, ok,
"success" if ok else "error",
json_lib.dumps(json_data, indent=2, ensure_ascii=False)[:10000],
respuesta[:1000] if respuesta else "",
respuesta[:300] if respuesta else "",
datetime.now().isoformat(),
))
conn.commit()
-22
View File
@@ -1,22 +0,0 @@
import sqlite3
conn = sqlite3.connect("rips_manager.db")
conn.row_factory = sqlite3.Row
rows = conn.execute("""
SELECT id, tipo, factura, status, mensaje_tns, contrato, created_at
FROM envios
WHERE json_enviado LIKE '%88272630%'
ORDER BY created_at DESC
LIMIT 20
""").fetchall()
if not rows:
print("Sin resultados para 88272630")
else:
for r in rows:
print(f"id={r['id']} tipo={r['tipo']} factura={r['factura']} status={r['status']} contrato={r['contrato']} fecha={r['created_at']}")
print(f" msg: {r['mensaje_tns']}")
print()
conn.close()