From d6655079d4cdabf00d13401a1ef72b1854b79c45 Mon Sep 17 00:00:00 2001 From: Jan Behrens Date: Sat, 2 Feb 2013 11:40:58 +0100 Subject: [PATCH] Fixing up after recent updates: correct win percentage; correct gametype display --- xonstat/batch/badges/skin.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xonstat/batch/badges/skin.py b/xonstat/batch/badges/skin.py index 67d4826..740b442 100644 --- a/xonstat/batch/badges/skin.py +++ b/xonstat/batch/badges/skin.py @@ -212,6 +212,9 @@ class Skin: game_types.insert(0, gt) else: game_types.append(gt) + + # make sure gametypes list if sorted correctly (number of games, descending) + game_types = sorted(game_types, key=lambda x: data['games_played'][x].games, reverse=True) @@ -348,7 +351,7 @@ class Skin: if not elos.has_key(gt) or not ranks.has_key(gt): continue count += 1 - + # re-align segments if less than max. gametypes are shown if count > 0: if count < self.num_gametypes: @@ -405,7 +408,7 @@ class Skin: txt = "???" try: - txt = "%.2f%%" % round(win_pct * 100, 2) + txt = "%.2f%%" % round(win_pct, 2) except: win_pct = 0 -- 2.39.2