]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
fix ordering of teams in game_info view
authorJan Behrens <zykure@web.de>
Fri, 19 Jul 2013 07:50:22 +0000 (09:50 +0200)
committerJan Behrens <zykure@web.de>
Fri, 19 Jul 2013 07:50:41 +0000 (09:50 +0200)
xonstat/views/game.py

index 70ac7e09be074b492a2deee44d4eca61e8d16761..97afe42188473dc13b8a3097dbbf4b23dc6d676a 100644 (file)
@@ -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()