From: Jan Behrens Date: Fri, 19 Jul 2013 07:50:22 +0000 (+0200) Subject: fix ordering of teams in game_info view X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5e82f3d172ea605cb7e438f02473c9a442335acf;p=xonotic%2Fxonstat.git fix ordering of teams in game_info view --- diff --git a/xonstat/views/game.py b/xonstat/views/game.py index 70ac7e0..97afe42 100644 --- a/xonstat/views/game.py +++ b/xonstat/views/game.py @@ -106,9 +106,14 @@ def _game_info_data(request): order_by(PlayerGameStat.score).\ all() - tgstats = DBSession.query(TeamGameStat).\ - filter(TeamGameStat.game_id == game_id).\ - order_by(TeamGameStat.score).\ + q = DBSession.query(TeamGameStat).\ + filter(TeamGameStat.game_id == game_id) + if game.game_type_cd == 'ctf': + q = q.order_by(TeamGameStat.caps.desc()) + elif game.game_type_cd == 'ca': + q = q.order_by(TeamGameStat.rounds.desc()) + + tgstats = q.order_by(TeamGameStat.score.desc()).\ all() stats_by_team = OrderedDict()