From 5e82f3d172ea605cb7e438f02473c9a442335acf Mon Sep 17 00:00:00 2001 From: Jan Behrens Date: Fri, 19 Jul 2013 09:50:22 +0200 Subject: [PATCH] fix ordering of teams in game_info view --- xonstat/views/game.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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() -- 2.39.2