Add player_ranks to the mix - it is a batch table intended to represent the latest...
[xonotic/xonstat.git] / xonstat / views / game.py
index 25ab4082333742a079b51d56bd91c4741bbe2408..1ce8a9ac74e5aeb164118a44db9da532f6427d66 100755 (executable)
@@ -3,7 +3,7 @@ import logging
 import re\r
 import time\r
 from pyramid.response import Response\r
-from sqlalchemy import desc\r
+from sqlalchemy import desc, func, over\r
 from webhelpers.paginate import Page, PageURL\r
 from xonstat.models import *\r
 from xonstat.util import page_url\r
@@ -106,10 +106,9 @@ def rank_index(request):
 \r
     game_type_cd = request.matchdict['game_type_cd']\r
 \r
-    ranks_q = DBSession.query(PlayerElo, Player).\\r
-            filter(PlayerElo.game_type_cd==game_type_cd).\\r
-            filter(PlayerElo.player_id==Player.player_id).\\r
-            order_by(PlayerElo.elo.desc())\r
+    ranks_q = DBSession.query(PlayerRank).\\r
+            filter(PlayerRank.game_type_cd==game_type_cd).\\r
+            order_by(PlayerRank.rank)\r
 \r
     ranks = Page(ranks_q, current_page, url=page_url)\r
 \r