Main Page - ${parent.title()}\r
</%block>\r
\r
-<div id="sidebar" class="leaderboard left">\r
+\r
+##### RECENT GAMES #####\r
+<h2>Recent Games</h2>\r
+<table id="recent-games">\r
+ <thead>\r
+ <tr>\r
+ <th>Game #</th>\r
+ <th>Type</th>\r
+ <th>Server</th>\r
+ <th>Map</th>\r
+ <th>Time</th>\r
+ <th>Winner</th>\r
+ </tr>\r
+ </thead>\r
+ <tbody>\r
+ % for (game, server, map, pgstat) in recent_games:\r
+ % if game != '-':\r
+ <tr>\r
+ <td><a href="${request.route_url('game_info', id=game.game_id)}" title="View detailed information about this game">${game.game_id}</a></td>\r
+ <td class="gt_icon"><img title="${game.game_type_cd}" src="/static/images/icons/24x24/${game.game_type_cd}.png" alt="${game.game_type_cd}" /></td>\r
+ <td><a href="${request.route_url('server_info', id=server.server_id)}" title="Go to the detail page for this server">${server.name}</a></td>\r
+ <td><a href="${request.route_url('map_info', id=map.map_id)}" title="Go to the map detail page for this map">${map.name}</a></td>\r
+ <td>${game.start_dt.strftime('%m/%d/%Y %H:%M')}</td>\r
+ <td class=\r
+ % if pgstat.team == 5:\r
+ "blue"\r
+ % elif pgstat.team == 14:\r
+ "red"\r
+ % elif pgstat.team == 13:\r
+ "yellow"\r
+ % endif\r
+ >\r
+ % if pgstat.player_id > 2:\r
+ <a href="${request.route_url('player_info', id=pgstat.player_id)}" title="Go to the player info page for this player">${pgstat.nick_html_colors()}</a></td>\r
+ % else:\r
+ ${pgstat.nick_html_colors()}</td>\r
+ % endif\r
+ </tr>\r
+ % else:\r
+ <tr>\r
+ <td>-</td>\r
+ <td>-</td>\r
+ <td>-</td>\r
+ <td>-</td>\r
+ <td>-</td>\r
+ <td>-</td>\r
+ </tr>\r
+ % endif\r
+ % endfor\r
+ </tbody>\r
+</table>\r
\r
##### TOP PLAYERS #####\r
+<div class="table_block">\r
<h2>Top Players</h2>\r
<table id="top-players">\r
<thead>\r
% endfor\r
</tbody>\r
</table>\r
+</div>\r
\r
##### TOP SERVERS #####\r
+<div class="table_block">\r
<h2>Top Servers</h2>\r
<table id="top-servers">\r
<thead>\r
% endfor\r
</tbody>\r
</table>\r
+</div>\r
\r
##### TOP MAPS #####\r
+<div class="table_block">\r
<h2>Top Maps</h2>\r
<table id="top-maps">\r
<thead>\r
% endfor\r
</tbody>\r
</table>\r
-</div> <!-- END LEADERBOARD -->\r
-\r
-<div id="main" class="right">\r
-\r
-##### RECENT GAMES #####\r
-<h2>Recent Games</h2>\r
-<table id="recent-games">\r
- <thead>\r
- <tr>\r
- <th>Game #</th>\r
- <th>Type</th>\r
- <th>Server</th>\r
- <th>Map</th>\r
- <th>Time</th>\r
- <th>Winner</th>\r
- </tr>\r
- </thead>\r
- <tbody>\r
- % for (game, server, map) in recent_games:\r
- % if game != '-':\r
- <tr>\r
- <td><a href="${request.route_url('game_info', id=game.game_id)}" title="View detailed information about this game">${game.game_id}</a></td>\r
- <td><img title="${game.game_type_cd}" src="/static/images/icons/24x24/${game.game_type_cd}.png" alt="${game.game_type_cd}" /></td>\r
- <td><a href="${request.route_url('server_info', id=server.server_id)}" title="Go to the detail page for this server">${server.name}</a></td>\r
- <td><a href="${request.route_url('map_info', id=map.map_id)}" title="Go to the map detail page for this map">${map.name}</a></td>\r
- <td>${game.start_dt.strftime('%m/%d/%Y %H:%M')}</td>\r
- <td>${game.winner}</td>\r
- </tr>\r
- % else:\r
- <tr>\r
- <td>-</td>\r
- <td>-</td>\r
- <td>-</td>\r
- <td>-</td>\r
- <td>-</td>\r
- <td>-</td>\r
- </tr>\r
- % endif\r
- % endfor\r
- </tbody>\r
-</table>\r
-</div> <!-- END RECENT GAMES -->\r
+</div>\r
leaderboard_lifetime = 30
leaderboard_count = 10
- recent_games_count = 32
+ recent_games_count = 20
# top players by score
top_players = DBSession.query(Player.player_id, Player.nick,
for i in range(leaderboard_count-len(top_maps)):
top_maps.append(('-', '-', '-'))
- recent_games = DBSession.query(Game, Server, Map).\
+ # recent games played in descending order
+ recent_games = DBSession.query(Game, Server, Map, PlayerGameStat).\
filter(Game.server_id==Server.server_id).\
filter(Game.map_id==Map.map_id).\
+ filter(PlayerGameStat.game_id==Game.game_id).\
+ filter(PlayerGameStat.rank==1).\
order_by(expr.desc(Game.start_dt)).all()[0:recent_games_count]
for i in range(recent_games_count-len(recent_games)):
- recent_games.append(('-', '-', '-'))
+ recent_games.append(('-', '-', '-', '-'))
return {'top_players':top_players,
'top_servers':top_servers,