add last places
This commit is contained in:
parent
94ea61e941
commit
3f1da81514
4 changed files with 10 additions and 0 deletions
|
@ -125,6 +125,7 @@ def do_play_card(bot, player, result_id):
|
||||||
us2 = UserSetting.get(id=game.current_player.user.id)
|
us2 = UserSetting.get(id=game.current_player.user.id)
|
||||||
if us2 and us2.stats:
|
if us2 and us2.stats:
|
||||||
us2.games_played += 1
|
us2.games_played += 1
|
||||||
|
us2.last_places += 1
|
||||||
|
|
||||||
gm.end_game(chat, user)
|
gm.end_game(chat, user)
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,7 @@ def kb_select(bot, update, groups):
|
||||||
us.first_places = 0
|
us.first_places = 0
|
||||||
us.games_played = 0
|
us.games_played = 0
|
||||||
us.cards_played = 0
|
us.cards_played = 0
|
||||||
|
us.last_places = 0
|
||||||
send_async(bot, chat.id, text=_("Deleted and disabled statistics!"))
|
send_async(bot, chat.id, text=_("Deleted and disabled statistics!"))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -134,6 +134,13 @@ def stats(bot, update):
|
||||||
n).format(number=n)
|
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
|
n = us.cards_played
|
||||||
stats_text.append(
|
stats_text.append(
|
||||||
_("{number} card played",
|
_("{number} card played",
|
||||||
|
|
|
@ -28,6 +28,7 @@ class UserSetting(db.Entity):
|
||||||
lang = Optional(str, default='') # The language setting for this user
|
lang = Optional(str, default='') # The language setting for this user
|
||||||
stats = Optional(bool, default=False) # Opt-in to keep game statistics
|
stats = Optional(bool, default=False) # Opt-in to keep game statistics
|
||||||
first_places = Optional(int, default=0) # Nr. of games won in first place
|
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
|
games_played = Optional(int, default=0) # Nr. of games completed
|
||||||
cards_played = Optional(int, default=0) # Nr. of cards played total
|
cards_played = Optional(int, default=0) # Nr. of cards played total
|
||||||
use_keyboards = Optional(bool, default=False) # Use keyboards (unused)
|
use_keyboards = Optional(bool, default=False) # Use keyboards (unused)
|
||||||
|
|
Loading…
Reference in a new issue