<h2>Sorry, that server wasn't found!</h2>
% else:
-<h2>Server Detail</h2>
+<h2>${server.name}</h2>
<ul>
- <li>ID: ${server.server_id}</li>
- <li>Name: ${server.name}</li>
- <li>Location: ${server.location}</li>
<li>IP Address: ${server.ip_addr}</li>
- <li>Maximum Players: ${server.max_players}</li>
- <li>Public Key: ${server.public_key}</li>
<li>Revision: ${server.revision}</li>
- <li>Pure Indicator: ${server.pure_ind}</li>
- <li>Active Indicator: ${server.active_ind}</li>
- <li>Created: ${server.create_dt}</li>
+ <li>Created: ${server.create_dt.strftime('%m/%d/%Y at %I:%M %p')}</li>
</ul>
+% if recent_games:
+<h2>Recent Games</h2>
+<ul>
+% 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> (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>
+More games played on ${server.name}...
+% endif
% endif
server_id = request.matchdict['id']
try:
server = DBSession.query(Server).filter_by(server_id=server_id).one()
- except:
+ 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 games g, servers s, maps m "
+ "where g.server_id=:server_id "
+ "and g.server_id = s.server_id "
+ "and g.map_id = m.map_id "
+ "order by g.start_dt desc "
+ "limit 10 offset 1").\
+ params(server_id=server_id).all()
+
+ except Exception as e:
server = None
- return {'server':server}
+ recent_games = None
+ return {'server':server,
+ 'recent_games':recent_games}
##########################################################################