Skip to content

Commit 0074e40

Browse files
committed
feat: if user has no statistics tell the user
Prior to this change we simply sent a weird ass statistics message. This just looked horrible and was pretty confusing.
1 parent fcf9cbe commit 0074e40

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

blackjackbot/lang/strings/translations_en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,6 @@
5252
"reset_stats_confirm_button": "Reset",
5353
"reset_stats_cancel_button": "Cancel",
5454
"reset_stats_executed": "Alright, I reset your statistics!",
55-
"reset_stats_cancelled": "Okay, I did not reset your statistics!"
55+
"reset_stats_cancelled": "Okay, I did not reset your statistics!",
56+
"no_stats": "You haven't played yet, there are no statistics for you."
5657
}

database/statistics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def get_user_stats(user_id):
6363

6464
if played_games == 0:
6565
# prevent division by zero errors
66-
played_games = 1
66+
return translate("no_stats")
6767

6868
last_played_formatted = datetime.utcfromtimestamp(last_played).strftime('%d.%m.%y %H:%M')
6969
win_percentage = round(float(won_games) / float(played_games), 4)

0 commit comments

Comments
 (0)