From b116c5bf4a4d3140384f1e2b4fcbac8ed53aa61b Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Mon, 23 May 2011 13:05:13 -0400 Subject: [PATCH] Show scoreboard on index page to avoid monotony. Only CTF supported right now. --- xonstat/templates/game_index.mako | 50 +++++++++++++++++++++++++++++-- xonstat/views.py | 10 ++++++- 2 files changed, 56 insertions(+), 4 deletions(-) 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): -- 2.39.2