From fb2d1f478bf953e15ebbf6256b26ab27282b2495 Mon Sep 17 00:00:00 2001 From: Jan Behrens Date: Tue, 11 Mar 2014 14:31:36 +0100 Subject: [PATCH] Order gametypes on player badges by playing time, not number of games --- xonstat/batch/badges/skin.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xonstat/batch/badges/skin.py b/xonstat/batch/badges/skin.py index f18370f..2ea0a99 100644 --- a/xonstat/batch/badges/skin.py +++ b/xonstat/batch/badges/skin.py @@ -212,9 +212,11 @@ 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) + #game_types = sorted(game_types, key=lambda x: data['games_played'][x].games, reverse=True) + # make sure gametypes list if sorted correctly (total playing time per game type, descending) + game_types = sorted(game_types, key=lambda x: data['overall_stats'][x].total_playing_time, reverse=True) @@ -351,7 +353,7 @@ class Skin: if not elos.has_key(gt): continue count += 1 - + # re-align segments if less than max. gametypes are shown if count > 0: if count < self.num_gametypes: -- 2.39.2