From 3f1da815143628107fc1ee7fceb43a74193c2f8f Mon Sep 17 00:00:00 2001 From: Pesakitan22 Date: Mon, 9 Apr 2018 08:31:12 +0700 Subject: [PATCH] add last places --- actions.py | 1 + settings.py | 1 + simple_commands.py | 7 +++++++ user_setting.py | 1 + 4 files changed, 10 insertions(+) diff --git a/actions.py b/actions.py index c8c5f1e..d00c583 100644 --- a/actions.py +++ b/actions.py @@ -125,6 +125,7 @@ def do_play_card(bot, player, result_id): us2 = UserSetting.get(id=game.current_player.user.id) if us2 and us2.stats: us2.games_played += 1 + us2.last_places += 1 gm.end_game(chat, user) diff --git a/settings.py b/settings.py index 622d897..a1ed009 100644 --- a/settings.py +++ b/settings.py @@ -79,6 +79,7 @@ def kb_select(bot, update, groups): us.first_places = 0 us.games_played = 0 us.cards_played = 0 + us.last_places = 0 send_async(bot, chat.id, text=_("Deleted and disabled statistics!")) diff --git a/simple_commands.py b/simple_commands.py index 6cc0c23..b640141 100644 --- a/simple_commands.py +++ b/simple_commands.py @@ -134,6 +134,13 @@ def stats(bot, update): n).format(number=n) ) + n = us.last_places + stats_text.append( + _("{number} last place", + "{number} last places", + n).format(number=n) + ) + n = us.cards_played stats_text.append( _("{number} card played", diff --git a/user_setting.py b/user_setting.py index c4e2c50..1213a9f 100644 --- a/user_setting.py +++ b/user_setting.py @@ -28,6 +28,7 @@ class UserSetting(db.Entity): lang = Optional(str, default='') # The language setting for this user stats = Optional(bool, default=False) # Opt-in to keep game statistics first_places = Optional(int, default=0) # Nr. of games won in first place + last_places = Optional(int, default=0) # Nr. of games last place games_played = Optional(int, default=0) # Nr. of games completed cards_played = Optional(int, default=0) # Nr. of cards played total use_keyboards = Optional(bool, default=False) # Use keyboards (unused)