config.add_route(name="main_index", pattern="/", view=main_index,
renderer='index.jinja2')
- config.add_route(name="player_info", pattern="/player/{id}", view=player_info,
+ config.add_route(name="player_info", pattern="/player/{id:\d+}", view=player_info,
renderer='player_info.mako')
- config.add_route(name="game_info", pattern="/game/{id}", view=game_info,
+ config.add_route(name="game_info", pattern="/game/{id:\d+}", view=game_info,
renderer='game_info.mako')
- config.add_route(name="server_info", pattern="/server/{id}", view=server_info,
+ config.add_route(name="server_info", pattern="/server/{id:\d+}", view=server_info,
renderer='server_info.mako')
- config.add_route(name="map_info", pattern="/map/{id}", view=map_info,
+ config.add_route(name="map_info", pattern="/map/{id:\d+}", view=map_info,
renderer='map_info.mako')
config.add_route(name="stats_submit", pattern="stats/submit",
% else:
<h2>Game Detail</h2>
<p>
-Played on: ${start_dt}<br />
+Played on: ${start_dt.strftime('%m/%d/%Y at %I:%M %p')}<br />
Game Type: ${game_type_cd}<br />
Server: <a href="${request.route_url("server_info", id=server_id)}" name="Server info page for ${server_name}">${server_name}</a><br />
Map: <a href="${request.route_url("map_info", id=map_id)}" name="Map info page for ${map_name}">${map_name}</a><br />
</p>
<h2>Scoreboard</h2>
-<table border="1">
+<table border="1" cellpadding="3">
+% if game_type_cd == 'ctf':
<tr>
<td>Nick</td>
<td>Kills</td>
- <td>Deaths</td>
- <td>Suicides</td>
<td>Captures</td>
- <td>Returns</td>
+ <td>Pickups</td>
<td>Flag Carrier Kills</td>
+ <td>Returns</td>
<td>Score</td>
</tr>
+
% for player_game_stat in player_game_stats:
<tr>
<td>${player_game_stat.nick_html_colors()}</td>
<td>${player_game_stat.kills}</td>
- <td>${player_game_stat.deaths}</td>
- <td>${player_game_stat.suicides}</td>
<td>${player_game_stat.captures}</td>
- <td>${player_game_stat.returns}</td>
+ <td>${player_game_stat.pickups}</td>
<td>${player_game_stat.carrier_frags}</td>
+ <td>${player_game_stat.returns}</td>
<td>${player_game_stat.score}</td>
</tr>
% endfor
+% endif
+
+% if game_type_cd == 'dm':
+ <tr>
+ <td>Nick</td>
+ <td>Kills</td>
+ <td>Deaths</td>
+ <td>Suicides</td>
+ <td>Score</td>
+ </tr>
+
+% for player_game_stat in player_game_stats:
+ <tr>
+ <td>${player_game_stat.nick_html_colors()}</td>
+ <td>${player_game_stat.kills}</td>
+ <td>${player_game_stat.deaths}</td>
+ <td>${player_game_stat.suicides}</td>
+ <td>${player_game_stat.score}</td>
+ </tr>
+% endfor
+% endif
</table>
% endif
% else:
<h2>Player Detail</h2>
-<ul>
- <li>Nickname: ${player.nick}</li>
- <li>ID: ${player.player_id}</li>
- <li>Location: ${player.location}</li>
- <li>Joined: ${player.create_dt}</li>
-</ul>
+<p>
+ Nickname: ${player.nick} <br />
+ Joined: ${player.create_dt.strftime('%m/%d/%Y at %I:%M %p')} <br />
+</p>
% endif
% if recent_games:
<h2>Recent Games</h2>
<ul>
-% for (game_id, server_name, map_name) in recent_games:
- <li>Game #${game_id} on ${server_name}: ${map_name}</li>
+% for (game_id, server_id, server_name, map_id, map_name) in recent_games:
+ <li><a href="${request.route_url("map_info", id=map_id)}" name="Map info page for ${map_name}">${map_name}</a> on <a href="${request.route_url("server_info", id=server_id)}" name="Server info page for ${server_name}">${server_name}</a> (game <a href="${request.route_url("game_info", id=game_id)}" name="Game info page for game #${game_id}">#${game_id}</a>)</li>
% endfor
</ul>
% endif
player_id = request.matchdict['id']
try:
player = DBSession.query(Player).filter_by(player_id=player_id).one()
- recent_games = DBSession.query("game_id", "server_name", "map_name").\
- from_statement("select g.game_id, s.name as server_name, m.name as map_name "
+ recent_games = DBSession.query("game_id", "server_id", "server_name",
+ "map_id", "map_name").\
+ from_statement("select g.game_id, s.server_id, s.name as server_name, m.map_id, m.name as map_name "
"from player_game_stats gs, games g, servers s, maps m "
"where gs.player_id=:player_id "
"and gs.game_id = g.game_id "
log.debug(recent_games)
except Exception as e:
- raise e
player = None
+ recent_games = None
return {'player':player, 'recent_games':recent_games}
def game_info(request):
game_id = request.matchdict['id']
try:
+ notfound = False
+
(start_dt, game_type_cd, server_id, server_name, map_id, map_name) = \
DBSession.query("start_dt", "game_type_cd", "server_id",
"server_name", "map_id", "map_name").\
"order by score desc").\
params(game_id=game_id).all()
except Exception as inst:
+ notfound = True
+ start_dt = None
+ game_type_cd = None
+ server_id = None
+ server_name = None
+ map_id = None
+ map_name = None
player_game_stats = None
- return {'start_dt':start_dt,
+
+ return {'notfound':notfound,
+ 'start_dt':start_dt,
'game_type_cd':game_type_cd,
'server_id':server_id,
'server_name':server_name,