From 345dc1016e2bb0977d97fa910dc8e88511f920ff Mon Sep 17 00:00:00 2001 From: Bhupesh-V Date: Thu, 5 Dec 2024 18:07:37 +0530 Subject: [PATCH] use Annonymous user instead of None --- aoc/main.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/aoc/main.py b/aoc/main.py index c010130..d545968 100644 --- a/aoc/main.py +++ b/aoc/main.py @@ -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" @@ -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()