From 8d9b7a9d347c61e1d5f988330b40d5618d6a75ad Mon Sep 17 00:00:00 2001 From: Bhupesh-V Date: Sat, 2 Dec 2023 18:59:40 +0530 Subject: [PATCH] set max count to 100 users --- aoc/main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/aoc/main.py b/aoc/main.py index 1d1be3d..e66caa9 100644 --- a/aoc/main.py +++ b/aoc/main.py @@ -18,19 +18,20 @@ def get_leaderboard_data(): data = response.json() return data -def format_leaderboard(data, num_players=20): +def format_leaderboard(data, num_players=100): leaderboard_stats = "r/developersIndia Advent of Code Leaderboard Stats\n\n" leaderboard_stats += "| Rank | Player | Stars | Score |\n" leaderboard_stats += "|------|--------|-------|-------|\n" # Sort members by stars in descending order - sorted_members = sorted(data['members'].values(), key=lambda x: x['stars'], reverse=True) + sorted_members = sorted(data['members'].values(), key=lambda x: x['local_score'], reverse=True) # Include only the top players for i, member_data in enumerate(sorted_members[:num_players]): leaderboard_stats += f"| {i + 1} | {member_data['name']} | {member_data['stars']} | {member_data['local_score']} |\n" leaderboard_stats += f"\n[Advent of Code Leaderboard](https://adventofcode.com/2023/leaderboard/private/view/{aoc_leaderboard_code})\n" + leaderboard_stats += f"\nUpdated every 24 hours" return leaderboard_stats