Slack daily margin table: show only sumatorio margin
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
bdc0d5ede3
commit
624f5e484d
@ -162,23 +162,19 @@ def build_and_send(collected: list, dry_run: bool, prev_month_metricas: dict = N
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
continue
|
continue
|
||||||
if d not in daily_totals:
|
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]["coste"] += vals.get("coste", 0)
|
||||||
daily_totals[d]["ingreso_sum"] += vals.get("ingreso", 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
|
margin_table_block = None
|
||||||
if daily_totals and not primer_dia_mes:
|
if daily_totals and not primer_dia_mes:
|
||||||
rows = ["Día Sumatorio LeadsxPPL"]
|
rows = ["Día Margen"]
|
||||||
for d in sorted(daily_totals):
|
for d in sorted(daily_totals):
|
||||||
coste = daily_totals[d]["coste"]
|
coste = daily_totals[d]["coste"]
|
||||||
ing_sum = daily_totals[d]["ingreso_sum"]
|
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_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_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:>7}")
|
||||||
rows.append(f"{d:02d} {s_sum:>9} {s_lxp:>9}")
|
|
||||||
margin_table_block = {
|
margin_table_block = {
|
||||||
"type": "section",
|
"type": "section",
|
||||||
"text": {
|
"text": {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user