mirror of
https://github.com/developersIndia/deviras.git
synced 2024-12-22 08:09:49 +05:30
set max count to 100 users
This commit is contained in:
parent
899674b01c
commit
8d9b7a9d34
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user