Skip to content

Commit

Permalink
use Annonymous user instead of None
Browse files Browse the repository at this point in the history
  • Loading branch information
Bhupesh-V committed Dec 5, 2024
1 parent 2824227 commit 345dc10
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion aoc/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ def format_leaderboard(data, num_players=100):
for i, member_data in enumerate(sorted_members[:num_players]):
# check for non-zero local_score
if member_data['local_score'] > 0:
# if member's name is null, use the member_id
if member_data['name'] == None:
member_data['name'] = f"Anonymous #{member_data['id']}"

leaderboard_stats += f"| {i + 1} | {member_data['name']} | {member_data['stars']} | {member_data['local_score']} |\n"

leaderboard_stats += f"\nUpdated every 24 hours"
Expand All @@ -56,7 +60,8 @@ def main():

leaderboard_data = get_leaderboard_data()
formatted_stats = format_leaderboard(leaderboard_data)
update_reddit_post(reddit, reddit_post_id, formatted_stats)
print(formatted_stats)
# update_reddit_post(reddit, reddit_post_id, formatted_stats)

if __name__ == "__main__":
main()

0 comments on commit 345dc10

Please sign in to comment.