chore: remove debug fields from preview response, simplify ventas filter
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
7ac17e29a9
commit
55bb34a1fa
@@ -454,25 +454,15 @@ async def preview_automation(
|
|||||||
if rda_por_pac.get(str(p.get("CODIGO", "")))
|
if rda_por_pac.get(str(p.get("CODIGO", "")))
|
||||||
]
|
]
|
||||||
|
|
||||||
grupos_vta_all = agrupar_por_factura(rows_vta)
|
|
||||||
ventas_debug = []
|
|
||||||
grupos_vta = {}
|
grupos_vta = {}
|
||||||
for k, v in grupos_vta_all.items():
|
for k, v in agrupar_por_factura(rows_vta).items():
|
||||||
if not isinstance(v, list) or not v:
|
if not isinstance(v, list) or not v:
|
||||||
continue
|
continue
|
||||||
num_fac_val = int(v[0].get("NUM_FACTURA") or 0)
|
if int(v[0].get("NUM_FACTURA") or 0) == 0:
|
||||||
contrato_val = str(v[0].get("CODCONTRATO") or "").strip()
|
continue
|
||||||
prefijo_val = str(v[0].get("PREFIJO") or "").strip()
|
if str(v[0].get("CODCONTRATO") or "").strip() in excluded_ventas:
|
||||||
motivo = None
|
continue
|
||||||
if num_fac_val == 0:
|
grupos_vta[k] = v
|
||||||
motivo = "sin_factura"
|
|
||||||
elif contrato_val in excluded_ventas:
|
|
||||||
motivo = f"excluido_ventas ({contrato_val})"
|
|
||||||
if motivo:
|
|
||||||
ventas_debug.append({"key": k, "prefijo": prefijo_val, "num_factura": num_fac_val,
|
|
||||||
"contrato": contrato_val, "motivo": motivo})
|
|
||||||
else:
|
|
||||||
grupos_vta[k] = v
|
|
||||||
|
|
||||||
ventas_preview = []
|
ventas_preview = []
|
||||||
ventas_gen_errors = []
|
ventas_gen_errors = []
|
||||||
@@ -505,9 +495,6 @@ async def preview_automation(
|
|||||||
"excluidos": excluidos_count,
|
"excluidos": excluidos_count,
|
||||||
"preservicios": len(grupos_ps),
|
"preservicios": len(grupos_ps),
|
||||||
"ventas": len(grupos_vta),
|
"ventas": len(grupos_vta),
|
||||||
"ventas_raw": len(rows_vta or []),
|
|
||||||
"ventas_grupos_total": len(grupos_vta_all),
|
|
||||||
"ventas_filtradas": ventas_debug,
|
|
||||||
"ventas_gen_errors": ventas_gen_errors,
|
"ventas_gen_errors": ventas_gen_errors,
|
||||||
"pacientes_preview": pacientes_preview,
|
"pacientes_preview": pacientes_preview,
|
||||||
"preservicios_preview": preservicios_preview,
|
"preservicios_preview": preservicios_preview,
|
||||||
|
|||||||
Reference in New Issue
Block a user