]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
A more comprehensive decision tree for team game stats.
authorAnt Zucaro <azucaro@gmail.com>
Sat, 20 Jul 2013 11:52:32 +0000 (07:52 -0400)
committerAnt Zucaro <azucaro@gmail.com>
Sat, 20 Jul 2013 11:52:32 +0000 (07:52 -0400)
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

index ec5ac757731c9d0e33f15ce01605b67f4bcf4b61..21bed83ac0b2cda895f96f14c310698a7266e051 100644 (file)
@@ -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: