From 7d2fe941049ee699c1516378c8ac92c673d41784 Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Sat, 20 Jul 2013 07:52:32 -0400 Subject: [PATCH] A more comprehensive decision tree for team game stats. If the game mode is CTF, order by caps. If the game mode is CA, FT, LMS, or KA then order by rounds. Otherwise order by score. This corresponds to the default settings for team_game_stat rows in the submission handler. --- xonstat/views/game.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xonstat/views/game.py b/xonstat/views/game.py index ec5ac75..21bed83 100644 --- a/xonstat/views/game.py +++ b/xonstat/views/game.py @@ -110,11 +110,12 @@ def _game_info_data(request): 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': + elif game.game_type_cd in 'ca' 'ft' 'lms' 'ka': q = q.order_by(TeamGameStat.rounds.desc()) + else: + q = q.order_by(TeamGameStat.score.desc()) - tgstats = q.order_by(TeamGameStat.score.desc()).\ - all() + tgstats = q.all() stats_by_team = OrderedDict() for pgstat in pgstats: -- 2.39.2