\r
##### TOP PLAYERS #####\r
<div class="table_block">\r
-<h2>Top Players</h2>\r
+<h2>Most Active Players</h2>\r
<table id="top-players">\r
<thead>\r
<tr>\r
<th>#</th>\r
<th>Nick</th>\r
- <th>Score</th>\r
+ <th>Playing Time</th>\r
</tr>\r
</thead>\r
<tbody>\r
<% i = 1 %>\r
- % for (player_id, nick, score) in top_players:\r
+ % for (player_id, nick, alivetime) in top_players:\r
<tr>\r
<td>${i}</td>\r
% if player_id != '-':\r
% else:\r
<td>${nick}</td>\r
% endif\r
- <td>${score}</td>\r
+ <td>${alivetime}</td>\r
</tr>\r
<% i = i+1 %>\r
% endfor\r
\r
##### TOP SERVERS #####\r
<div class="table_block">\r
-<h2>Top Servers</h2>\r
+<h2>Most Active Servers</h2>\r
<table id="top-servers">\r
<thead>\r
<tr>\r
<th>#</th>\r
<th>Server</th>\r
- <th>Games</th>\r
+ <th># Games</th>\r
</tr>\r
</thead>\r
<tbody>\r
\r
##### TOP MAPS #####\r
<div class="table_block">\r
-<h2>Top Maps</h2>\r
+<h2>Most Active Maps</h2>\r
<table id="top-maps">\r
<thead>\r
<tr>\r
<th>#</th>\r
<th>Map</th>\r
- <th>Times Played</th>\r
+ <th># Games</th>\r
</tr>\r
</thead>\r
<tbody>\r
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]