From: Ant Zucaro Date: Sun, 16 Oct 2011 23:18:47 +0000 (-0400) Subject: Fix the top maps count. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0c77a771f5265e6e004c0531788a7f037efbbc07;p=xonotic%2Fxonstat.git Fix the top maps count. --- 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(('-', '-', '-'))