Show the repost as an excluded row in All Posts, not silently absent

10/07 was fully filtered out of the Engagement Composition table by
_reports_posts_f() (correct for calculations, but invisible to a reader).
Now it appears struck through with a pale-red background and "Excluded"
written next to it, same transparency treatment Core Message's register
table already gives it — visible and clearly marked, not hidden.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
beantownbabeandClaude Sonnet 5 committed 2026-09-14 08:59:21 +02:00
1 parent 27a6ef77ba
commit 9859b379c9
1 file changed
+28 -1
+28 -1
View File
@@ -3450,6 +3450,13 @@ def _all_posts_insights_page(month_value="2026-07"):
], style={"display": "flex", "gap": "0.75rem", "marginBottom": "1rem"})
_comp_df = _reports_posts_f(month_value).sort_values("Created date").copy()
# _reports_posts_f() correctly excludes REPOST_DATES from every calculation, but
# per Mckinley's request the repost should still be VISIBLE here, struck through
# and marked Excluded, not silently missing from the post list — same
# transparency treatment Core Message's register table already gives it.
_repost_rows = posts_f_all[posts_f_all["Created date"].dt.strftime("%Y-%m-%d").isin(REPOST_DATES)]
if not _repost_rows.empty:
_comp_df = pd.concat([_comp_df, _repost_rows]).sort_values("Created date")
_comp_df["Date"] = _comp_df["Created date"].dt.strftime("%d/%m")
def _first_n_words(text, n=5):
@@ -3459,7 +3466,28 @@ def _all_posts_insights_page(month_value="2026-07"):
_th_yellow_comp = {"backgroundColor": "#fdf6d8"}
_post_style_comp = {"whiteSpace": "nowrap", "overflow": "hidden", "textOverflow": "ellipsis", "maxWidth": "90px"}
_type_abbrev = {"Text/Image": "T", "Carousel": "C", "Video": "V", "Poll": "P"}
def _comp_row(r):
if r["Created date"].strftime("%Y-%m-%d") in REPOST_DATES:
# Visible, not silently dropped, but struck through and clearly marked —
# same pale-red/strikethrough treatment as Core Message's register table.
excl = {"backgroundColor": "#fbdcdc", "textDecoration": "line-through"}
return html.Tr([
html.Td([_first_n_words(r["Short title"], 3), " ", html.Strong("Excluded")],
title=str(r["Short title"]), style={**_post_style_comp, **excl}),
html.Td(_type_abbrev.get(r["Content Type"], r["Content Type"]),
title=r["Content Type"], style={"whiteSpace": "nowrap", "textAlign": "center", **excl}),
html.Td(r["Date"], style={"whiteSpace": "nowrap", **excl}),
html.Td(f"{int(r['Impressions']):,}", style={"whiteSpace": "nowrap", **excl}),
html.Td(int(r["Clicks"]), style={"whiteSpace": "nowrap", **excl}),
html.Td(f"{r['CTR %']:.1f}%", style={"whiteSpace": "nowrap", **excl}),
html.Td("Excluded", style={"whiteSpace": "nowrap", **excl}),
html.Td(int(r["Likes"]), style={"textAlign": "center", **excl}),
html.Td(int(r["Comments"]), style={"textAlign": "center", **excl}),
html.Td(int(r["Reposts"]), style={"textAlign": "center", **excl}),
html.Td("Repost, excluded from comparison", style={"fontSize": "0.76rem", **excl}),
])
audit = _AUDIENCE_TEAM_AUDIT.get(r["Date"])
if audit:
# Plain counts, not percentages — a share-of-total on a small organic base
@@ -3485,7 +3513,6 @@ def _all_posts_insights_page(month_value="2026-07"):
likes_cell = html.Td(int(r["Likes"]), style=_plain_style)
comments_cell = html.Td(int(r["Comments"]), style=_plain_style)
reposts_cell = html.Td(int(r["Reposts"]), style=_plain_style)
_type_abbrev = {"Text/Image": "T", "Carousel": "C", "Video": "V", "Poll": "P"}
real_eng = r["Real Eng %"]
real_eng_cell = (html.Td(f"{real_eng:.1f}%", style={"whiteSpace": "nowrap", "fontWeight": "700"})
if pd.notna(real_eng) else