From 9d03bdc73731c4e479a6f5c9f4f30a08ca631693 Mon Sep 17 00:00:00 2001 From: Archos Date: Mon, 15 Jun 2026 19:03:47 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20top=20odkazy=20i=20v=20m=C4=9Bs=C3=AD?= =?UTF-8?q?=C4=8Dn=C3=ADm=20p=C5=99ehledu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weekly_report.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/weekly_report.py b/weekly_report.py index ae139c2..ba39284 100644 --- a/weekly_report.py +++ b/weekly_report.py @@ -127,7 +127,7 @@ def format_month_cs(dt): return f"{months[dt.month - 1]} {dt.year}" def build_monthly_toot(measures_data, tags, top_tooty, date_to, prev_stats, instance_info, - total_count=0, top_author=None, newest_account=None): + total_count=0, top_author=None, newest_account=None, top_links=None): stats = {m["key"]: int(m["total"]) for m in measures_data} new_users = stats.get("new_users", 0) active_users = stats.get("active_users", 0) @@ -164,6 +164,15 @@ def build_monthly_toot(measures_data, tags, top_tooty, date_to, prev_stats, inst else: tooty_sekce = "" + if top_links: + link_lines = "\n".join( + f"🔗 {link.get('title', link.get('url', ''))}\n{link.get('provider_name', '')} · {link.get('url', '')}" + for link in top_links[:3] + ) + links_sekce = f"\n🌐 Top odkazy měsíce:\n\n{link_lines}" + else: + links_sekce = "" + return ( f"🐘 Měsíční přehled Mamutovo.cz\n" f"📅 {format_month_cs(date_to)}\n" @@ -181,6 +190,7 @@ def build_monthly_toot(measures_data, tags, top_tooty, date_to, prev_stats, inst f"\n" f"{extra}" f"{tooty_sekce}" + f"{links_sekce}" ) def build_toot(measures_data, tags, top_tooty, date_from, date_to, week_number, @@ -397,9 +407,10 @@ def main(): total_count = load_total_count_from_data(date_to, 30) top_author = load_top_author_from_data(date_to, 30) newest_account = load_newest_account_from_data(date_to, 30) + top_links = load_top_links_from_data(date_to, 30) toot = build_monthly_toot( measures_data, tags, top_tooty, date_to, prev_stats, instance_info, - total_count, top_author, newest_account, + total_count, top_author, newest_account, top_links, ) if args.dry_run: