diff --git a/slack_reporter.py b/slack_reporter.py index e69f6e8..5d84306 100644 --- a/slack_reporter.py +++ b/slack_reporter.py @@ -162,23 +162,19 @@ def build_and_send(collected: list, dry_run: bool, prev_month_metricas: dict = N except ValueError: continue if d not in daily_totals: - daily_totals[d] = {"coste": 0.0, "ingreso_sum": 0.0, "ingreso_lxp": 0.0} + daily_totals[d] = {"coste": 0.0, "ingreso_sum": 0.0} daily_totals[d]["coste"] += vals.get("coste", 0) daily_totals[d]["ingreso_sum"] += vals.get("ingreso", 0) - daily_totals[d]["ingreso_lxp"] += vals.get("leads_lake", 0) * ppl margin_table_block = None if daily_totals and not primer_dia_mes: - rows = ["Día Sumatorio LeadsxPPL"] + rows = ["Día Margen"] for d in sorted(daily_totals): coste = daily_totals[d]["coste"] ing_sum = daily_totals[d]["ingreso_sum"] - ing_lxp = daily_totals[d]["ingreso_lxp"] pct_sum = round((ing_sum - coste) / ing_sum * 100, 1) if ing_sum > 0 else 0.0 - pct_lxp = round((ing_lxp - coste) / ing_lxp * 100, 1) if ing_lxp > 0 else 0.0 s_sum = ("+" if pct_sum >= 0 else "") + f"{pct_sum:.1f}%" - s_lxp = ("+" if pct_lxp >= 0 else "") + f"{pct_lxp:.1f}%" - rows.append(f"{d:02d} {s_sum:>9} {s_lxp:>9}") + rows.append(f"{d:02d} {s_sum:>7}") margin_table_block = { "type": "section", "text": {