From: Jan Behrens Date: Sun, 6 Apr 2014 13:42:38 +0000 (+0200) Subject: fix missing gametypes in some player badges X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=refs%2Fheads%2Fzykure%2Fwip;p=xonotic%2Fxonstat.git fix missing gametypes in some player badges --- diff --git a/xonstat/batch/badges/skin.py b/xonstat/batch/badges/skin.py index 2ea0a99..edcb2eb 100644 --- a/xonstat/batch/badges/skin.py +++ b/xonstat/batch/badges/skin.py @@ -204,22 +204,18 @@ class Skin: # make sorted list of gametypes game_types = [] - num_games = 0 - for gt,info in data['games_played'].items(): - if gt == "overall": + for gt in data['games_played'].keys(): + if gt == 'overall': continue - if info.games > num_games: - game_types.insert(0, gt) - else: - game_types.append(gt) + if elos.has_key(gt): + game_types.append(gt) # only uses gametypes with elo values (needed later on) - # 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) + ## 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) # 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) - # build image surf = C.ImageSurface(C.FORMAT_ARGB32, self.width, self.height)