From: Ant Zucaro Date: Mon, 23 May 2011 17:05:13 +0000 (-0400) Subject: Show scoreboard on index page to avoid monotony. Only CTF supported right now. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b116c5bf4a4d3140384f1e2b4fcbac8ed53aa61b;p=xonotic%2Fxonstat.git Show scoreboard on index page to avoid monotony. Only CTF supported right now. --- diff --git a/xonstat/templates/game_index.mako b/xonstat/templates/game_index.mako index 2e90840..8024184 100755 --- a/xonstat/templates/game_index.mako +++ b/xonstat/templates/game_index.mako @@ -9,11 +9,55 @@ Game Index - ${parent.title()} % else:

Recent Games

- % endif % if games.previous_page: diff --git a/xonstat/views.py b/xonstat/views.py index 3cf5d05..36afef4 100755 --- a/xonstat/views.py +++ b/xonstat/views.py @@ -127,7 +127,15 @@ def game_index(request): games = Page(games_q, current_page, url=page_url) - return {'games':games} + pgstats = {} + for (game, server, map) in games: + pgstats[game.game_id] = DBSession.query(PlayerGameStat).\ + filter(PlayerGameStat.game_id == game.game_id).\ + order_by(PlayerGameStat.rank).\ + order_by(PlayerGameStat.score).all() + + return {'games':games, + 'pgstats':pgstats} def game_info(request):