From 0c77a771f5265e6e004c0531788a7f037efbbc07 Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Sun, 16 Oct 2011 19:18:47 -0400 Subject: [PATCH] Fix the top maps count. --- xonstat/views/main.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/xonstat/views/main.py b/xonstat/views/main.py index c22fc88..e848410 100755 --- a/xonstat/views/main.py +++ b/xonstat/views/main.py @@ -38,13 +38,15 @@ def main_index(request): top_servers.append(('-', '-', '-')) # top maps by total times played - top_maps = DBSession.query(Map.map_id, Map.name, - func.count(Game.game_id)).\ - filter(Map.map_id==Game.game_id).\ - order_by(expr.desc(func.count(Game.game_id))).\ - group_by(Map.map_id).\ + top_maps = DBSession.query(Game.map_id, Map.name, + func.count()).\ + filter(Map.map_id==Game.map_id).\ + order_by(expr.desc(func.count())).\ + group_by(Game.map_id).\ group_by(Map.name).all()[0:10] + log.debug(top_maps) + for i in range(leaderboard_count-len(top_maps)): top_maps.append(('-', '-', '-')) -- 2.39.2