diff --git a/src/db.py b/src/db.py index 4946c7f..7b07656 100644 --- a/src/db.py +++ b/src/db.py @@ -352,13 +352,21 @@ def get_player_totals(acc, hostmask): totals = [] for row in c: tmp[row[0]] = row[1] + c.execute("""SELECT SUM(gp.team_win | gp.indiv_win) + FROM game_player gp + JOIN player pl + ON gp.player = pl.id + JOIN person pe + ON pl.person = pe.id + WHERE pe.id = ?""", (peid,)) + won_games = c.fetchone()[0] order = role_order() name = _get_display_name(peid) #ordered role stats totals = ["\u0002{0}\u0002: {1}".format(r, tmp[r]) for r in order if r in tmp] #lover or any other special stats totals += ["\u0002{0}\u0002: {1}".format(r, t) for r, t in tmp.items() if r not in order] - return "\u0002{0}\u0002's totals | \u0002{1}\u0002 games | {2}".format(name, total_games, break_long_message(totals, ", ")) + return "\u0002{0}\u0002's totals | \u0002{1}\u0002 games | Winrate: \u0002{2:.0%}\u0002 | {3}".format(name, total_games, won_games / total_games, break_long_message(totals, ", ")) def get_game_stats(mode, size): conn = _conn()