From: Ant Zucaro Date: Thu, 3 Nov 2011 11:04:33 +0000 (-0400) Subject: Change titles, rank by alivetime for active players. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4f92090aa3b3c1b43ea52f740580700c102181ce;p=xonotic%2Fxonstat.git Change titles, rank by alivetime for active players. --- diff --git a/xonstat/templates/main_index.mako b/xonstat/templates/main_index.mako index 88fe8ca..b482efa 100755 --- a/xonstat/templates/main_index.mako +++ b/xonstat/templates/main_index.mako @@ -58,18 +58,18 @@ Main Page - ${parent.title()} ##### TOP PLAYERS #####
-

Top Players

+

Most Active Players

- + <% i = 1 %> - % for (player_id, nick, score) in top_players: + % for (player_id, nick, alivetime) in top_players: % if player_id != '-': @@ -77,7 +77,7 @@ Main Page - ${parent.title()} % else: % endif - + <% i = i+1 %> % endfor @@ -87,13 +87,13 @@ Main Page - ${parent.title()} ##### TOP SERVERS #####
-

Top Servers

+

Most Active Servers

# NickScorePlaying Time
${i}${nick}${score}${alivetime}
- + @@ -116,13 +116,13 @@ Main Page - ${parent.title()} ##### TOP MAPS #####
-

Top Maps

+

Most Active Maps

# ServerGames# Games
- + diff --git a/xonstat/views/main.py b/xonstat/views/main.py index 1b36ad6..d81487c 100755 --- a/xonstat/views/main.py +++ b/xonstat/views/main.py @@ -20,14 +20,14 @@ def main_index(request): leaderboard_count = 10 recent_games_count = 20 - # top players by score + # top players by playing time top_players = DBSession.query(Player.player_id, Player.nick, - func.sum(PlayerGameStat.score)).\ + func.sum(PlayerGameStat.alivetime)).\ filter(Player.player_id == PlayerGameStat.player_id).\ filter(Player.player_id > 2).\ filter(PlayerGameStat.create_dt > (datetime.now() - timedelta(days=leaderboard_lifetime))).\ - order_by(expr.desc(func.sum(PlayerGameStat.score))).\ + order_by(expr.desc(func.sum(PlayerGameStat.alivetime))).\ group_by(Player.nick).\ group_by(Player.player_id).all()[0:10]
# MapTimes Played# Games