38 lines
1.3 KiB
Python
38 lines
1.3 KiB
Python
# diag_asignados_diana_hoy.py
|
|
# Leads ASIGNADOS a DIANA el dia 13 (hoy) de agosto 2026, con telefono, hora y
|
|
# si respondio o no. Fuente: mensajes de asignacion de Chatwoot.
|
|
from datetime import datetime
|
|
from data_manager_v2 import DataManager
|
|
|
|
ANO, MES, DIA = 2026, 8, 13
|
|
NOMBRE = "DIANA"
|
|
|
|
dm = DataManager()
|
|
|
|
filas = []
|
|
for r in dm.traer_asignacion_respuesta():
|
|
if NOMBRE not in (r.get("user_name") or "").upper():
|
|
continue
|
|
t1 = r.get("created_at")
|
|
if not isinstance(t1, datetime):
|
|
continue
|
|
if t1.year == ANO and t1.month == MES and t1.day == DIA:
|
|
filas.append(r)
|
|
|
|
print(f"\n=== DIANA — leads ASIGNADOS el {DIA:02d}/{MES:02d}/{ANO} ===\n")
|
|
print(f"Total asignados hoy: {len(filas)}\n")
|
|
print(f"{'#':3} {'telefono':13} {'asignado':11} {'respondio':11} estado")
|
|
print("-"*55)
|
|
resp = 0; sinr = 0
|
|
for i, r in enumerate(sorted(filas, key=lambda x: x['created_at']), 1):
|
|
t1 = r['created_at']; t2 = r.get('respuesta_fecha')
|
|
tel = r.get('telefono', '')
|
|
if isinstance(t2, datetime):
|
|
resp += 1
|
|
print(f"{i:3} {tel:13} {t1.strftime('%H:%M:%S'):11} {t2.strftime('%H:%M:%S'):11} respondio")
|
|
else:
|
|
sinr += 1
|
|
print(f"{i:3} {tel:13} {t1.strftime('%H:%M:%S'):11} {'':11} SIN RESPONDER")
|
|
print("-"*55)
|
|
print(f"Respondidos: {resp} | Sin responder: {sinr} | Total: {len(filas)}")
|