add last places

This commit is contained in:
Pesakitan22 2018-04-09 08:31:12 +07:00
parent 94ea61e941
commit 3f1da81514
4 changed files with 10 additions and 0 deletions

View file

@ -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)

View file

@ -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!"))

View file

@ -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",

View file

@ -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)