From c604da12c7cc9cb79b102d0a2d7bc5e7f7834c32 Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Thu, 4 Dec 2025 18:46:44 -0800 Subject: [PATCH] Show completed parts --- aocsync.py | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/aocsync.py b/aocsync.py index 013ea18..70bb59e 100755 --- a/aocsync.py +++ b/aocsync.py @@ -1318,6 +1318,19 @@ class HTMLGenerator: for part in day.values(): users_with_data.update(part.keys()) + # Calculate stars (completed parts) per user per year + stars_by_user_year = defaultdict(lambda: defaultdict(int)) + for year in data: + for day in data[year].values(): + for part in day.values(): + for user, time_data in part.items(): + if isinstance(time_data, dict): + total_time = time_data.get('total', 0) + else: + total_time = time_data if time_data > 0 else 0 + if total_time > 0: + stars_by_user_year[user][year] += 1 + # Check if log file exists log_file_path = Path(config.output_dir) / 'cargo-aoc.log' log_file_exists = log_file_path.exists() @@ -1777,6 +1790,43 @@ class HTMLGenerator:

Users: """ + ', '.join(sorted(users)) + """

""" + (f'

📋 View Cargo AOC Logs

' if log_file_exists else '') + """ + + +
+

⭐ Stars Summary

+

Number of completed parts (stars) per user per year

+ + + + +""" + # Add year columns + for year in sorted_years: + html += f" \n" + html += """ + + + +""" + # Add rows for each user + for user in sorted(users): + html += f""" + +""" + total_stars = 0 + for year in sorted_years: + stars = stars_by_user_year[user][year] + total_stars += stars + if stars > 0: + html += f" \n" + else: + html += " \n" + html += f" \n" + html += " \n" + + html += """ +
User{year}Total
{user}{stars} ⭐-{total_stars} ⭐
+
""" # Generate content for each year (sorted descending)