Main Page - ${parent.title()}\r
</%block>\r
\r
-\r
-##### RECENT GAMES #####\r
-<h2>Recent Games</h2>\r
-<table id="recent-games">\r
+##### DUEL RANKS #####\r
+<div class="table_block">\r
+<h2>Duel Ranks</h2>\r
+<table class="rank-table">\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
+ <th>#</th>\r
+ <th>Nick</th>\r
+ <th>Elo</th>\r
</tr>\r
</thead>\r
<tbody>\r
- % for (game, server, map, pgstat) in recent_games:\r
- % if game != '-':\r
+ <% i = 1 %>\r
+ % for (player_id, nick, elo) in duel_ranks:\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
+ <td>${i}</td>\r
+ % if player_id != '-':\r
+ <td><a href="${request.route_url('player_info', id=player_id)}" title="Go to the player info page for this player">${nick}</a></td>\r
+ % else:\r
+ <td>${nick}</td>\r
+ % endif\r
+ % if elo != '-':\r
+ <td>${round(elo, 3)}</td>\r
+ % else:\r
+ <td>${elo}</td>\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()|n}</a></td>\r
+ </tr>\r
+ <% i = i+1 %>\r
+ % endfor\r
+ </tbody>\r
+</table>\r
+<p class="note"><a href="${request.route_url('rank_index', page=1, game_type_cd='duel')}" title="See more duel rankings">More...</a></p>\r
+</div>\r
+\r
+\r
+\r
+##### CTF RANKS #####\r
+<div class="table_block">\r
+<h2>CTF Ranks</h2>\r
+<table class="rank-table">\r
+ <thead>\r
+ <tr>\r
+ <th>#</th>\r
+ <th>Nick</th>\r
+ <th>Elo</th>\r
+ </tr>\r
+ </thead>\r
+ <tbody>\r
+ <% i = 1 %>\r
+ % for (player_id, nick, elo) in ctf_ranks:\r
+ <tr>\r
+ <td>${i}</td>\r
+ % if player_id != '-':\r
+ <td><a href="${request.route_url('player_info', id=player_id)}" title="Go to the player info page for this player">${nick}</a></td>\r
+ % else:\r
+ <td>${nick}</td>\r
+ % endif\r
+ % if elo != '-':\r
+ <td>${round(elo, 3)}</td>\r
% else:\r
- ${pgstat.nick_html_colors()|n}</td>\r
+ <td>${elo}</td>\r
% endif\r
</tr>\r
- % else:\r
+ <% i = i+1 %>\r
+ % endfor\r
+ </tbody>\r
+</table>\r
+<p class="note"><a href="${request.route_url('rank_index', page=1, game_type_cd='ctf')}" title="See more CTF rankings">More...</a></p>\r
+</div>\r
+\r
+\r
+\r
+##### DM RANKS #####\r
+<div class="table_block">\r
+<h2>DM Ranks</h2>\r
+<table class="rank-table">\r
+ <thead>\r
<tr>\r
- <td>-</td>\r
- <td>-</td>\r
- <td>-</td>\r
- <td>-</td>\r
- <td>-</td>\r
- <td>-</td>\r
+ <th>#</th>\r
+ <th>Nick</th>\r
+ <th>Elo</th>\r
</tr>\r
- % endif\r
- % endfor\r
- </tbody>\r
+ </thead>\r
+ <tbody>\r
+ <% i = 1 %>\r
+ % for (player_id, nick, elo) in dm_ranks:\r
+ <tr>\r
+ <td>${i}</td>\r
+ % if player_id != '-':\r
+ <td><a href="${request.route_url('player_info', id=player_id)}" title="Go to the player info page for this player">${nick}</a></td>\r
+ % else:\r
+ <td>${nick}</td>\r
+ % endif\r
+ % if elo != '-':\r
+ <td>${round(elo, 3)}</td>\r
+ % else:\r
+ <td>${elo}</td>\r
+ % endif\r
+ </tr>\r
+ <% i = i+1 %>\r
+ % endfor\r
+ </tbody>\r
</table>\r
+<p class="note"><a href="${request.route_url('rank_index', page=1, game_type_cd='dm')}" title="See more deathmatch rankings">More...</a></p>\r
+</div>\r
+\r
+\r
\r
##### TOP PLAYERS #####\r
<div class="table_block">\r
<tr>\r
<th>#</th>\r
<th>Nick</th>\r
- <th>Playing Time</th>\r
+ <th class="play-time">Play Time</th>\r
</tr>\r
</thead>\r
<tbody>\r
% else:\r
<td>${nick}</td>\r
% endif\r
- <td>${alivetime}</td>\r
+ <td class="play-time">${alivetime}</td>\r
</tr>\r
<% i = i+1 %>\r
% endfor\r
</tbody>\r
</table>\r
+<p class="note">*Most active stats are from the past 7 days</p>\r
</div>\r
\r
##### TOP SERVERS #####\r
<tr>\r
<th>#</th>\r
<th>Server</th>\r
- <th># Games</th>\r
+ <th>Games</th>\r
</tr>\r
</thead>\r
<tbody>\r
<tr>\r
<th>#</th>\r
<th>Map</th>\r
- <th># Games</th>\r
+ <th>Games</th>\r
</tr>\r
</thead>\r
<tbody>\r
</tbody>\r
</table>\r
</div>\r
+\r
+\r
+\r
+##### RECENT GAMES #####\r
+<div class="table_block">\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()|n}</a></td>\r
+ % else:\r
+ ${pgstat.nick_html_colors()|n}</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
+</div>\r
+\r
+\r
leaderboard_count = 10
recent_games_count = 20
+ # top ranked duelers
+ duel_ranks = DBSession.query(Player.player_id, Player.nick, PlayerElo.elo).\
+ filter(Player.player_id==PlayerElo.player_id).\
+ filter(PlayerElo.game_type_cd=='duel').\
+ order_by(expr.desc(PlayerElo.elo)).all()[0:10]
+
+ duel_ranks = [(player_id, html_colors(nick), elo) \
+ for (player_id, nick, elo) in duel_ranks]
+
+ for i in range(leaderboard_count-len(duel_ranks)):
+ duel_ranks.append(('-', '-', '-'))
+
+ # top ranked CTF-ers
+ ctf_ranks = DBSession.query(Player.player_id, Player.nick, PlayerElo.elo).\
+ filter(Player.player_id==PlayerElo.player_id).\
+ filter(PlayerElo.game_type_cd=='ctf').\
+ order_by(expr.desc(PlayerElo.elo)).all()[0:10]
+
+ ctf_ranks = [(player_id, html_colors(nick), elo) \
+ for (player_id, nick, elo) in ctf_ranks]
+
+ for i in range(leaderboard_count-len(ctf_ranks)):
+ ctf_ranks.append(('-', '-', '-'))
+
+ # top ranked DM-ers
+ dm_ranks = DBSession.query(Player.player_id, Player.nick, PlayerElo.elo).\
+ filter(Player.player_id==PlayerElo.player_id).\
+ filter(PlayerElo.game_type_cd=='dm').\
+ order_by(expr.desc(PlayerElo.elo)).all()[0:10]
+
+ dm_ranks = [(player_id, html_colors(nick), elo) \
+ for (player_id, nick, elo) in dm_ranks]
+
+ for i in range(leaderboard_count-len(dm_ranks)):
+ dm_ranks.append(('-', '-', '-'))
+
# top players by playing time
top_players = DBSession.query(Player.player_id, Player.nick,
func.sum(PlayerGameStat.alivetime)).\
'top_servers':top_servers,
'top_maps':top_maps,
'recent_games':recent_games,
+ 'duel_ranks':duel_ranks,
+ 'ctf_ranks':ctf_ranks,
+ 'dm_ranks':dm_ranks,
}