.table .tdcenter { text-align: center; }
-/* Game Info */
+/* Game Info and Game Index*/
.game-detail img {
float: left;
margin-right: 10px;
+ margin-bottom: 5px;
+}
+
+.game img {
+ float: left;
+ margin-right: 5px;
+ margin-bottom: 5px;
}
-.game-detail p {
+.game-detail p,
+.game h4 {
float: left;
}
<div class="row">
<div class="span12">
<h2>Recent Games</h2>
- % for (game, server, map) in games:
+ % for (game, server, map, gametype) in games:
<div class="game">
- <h4><img src="/static/images/icons/48x48/${game.game_type_cd}.png" width="30" height="30" /><a href="${request.route_url("map_info", id=map.map_id)}" name="Map info page for ${map.name}">${map.name}</a> on <a href="${request.route_url("server_info", id=server.server_id)}" name="Server info page for ${server.name}">${server.name}</a> <span class="permalink">(<a href="${request.route_url('game_info', id=game.game_id)}" name="Permalink for game #${game.game_id}">permalink</a>)</span></h4>
+ <img src="/static/images/icons/48x48/${game.game_type_cd}.png" width="30" height="30" alt="${game.game_type_cd}" title="${gametype.descr}"/>
+ <h4><a href="${request.route_url("map_info", id=map.map_id)}" name="Map info page for ${map.name}">${map.name}</a> on <a href="${request.route_url("server_info", id=server.server_id)}" name="Server info page for ${server.name}">${server.name}</a> <span class="permalink">(<a href="${request.route_url('game_info', id=game.game_id)}" name="Permalink for game #${game.game_id}">permalink</a>)</span></h4>
+ <span class="clear"></span>
${scoreboard(game.game_type_cd, pgstats[game.game_id])}
</div>
% endfor
<div class="row">
<div class="span10 game-detail">
<h2>Game Detail</h2>
- <img width="48" height="48" src="/static/images/icons/48x48/${game.game_type_cd}.png" alt="${game.game_type_cd}" title="${game.game_type_cd}"/>
+ <img width="48" height="48" src="/static/images/icons/48x48/${game.game_type_cd}.png" alt="${game.game_type_cd}"/>
<p>
Played: <span class="abstime" data-epoch="${game.epoch()}" title="${game.start_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${game.fuzzy_date()}</span><br />
- Game Type: ${game.game_type_cd}<br />
+ Game Type: ${game.game_type_cd} (${gametype.descr})<br />
Server: <a href="${request.route_url("server_info", id=server.server_id)}" name="Server info page for ${server.name}">${server.name}</a><br />
Map: <a href="${request.route_url("map_info", id=map.map_id)}" name="Map info page for ${map.name}">${map.name}</a><br />
% if game.duration is not None:
<tr>
<td><a class="btn btn-primary btn-small" href="${request.route_url('game_info', id=rg.game_id)}" title="View detailed information about this game">view</a></td>
<!-- <td class="gt_icon"><img title="${rg.game_type_cd}" src="/static/images/icons/24x24/${rg.game_type_cd}.png" alt="${rg.game_type_cd}" /></td> -->
- <td><span class="sprite sprite-${rg.game_type_cd}" title="${rg.game_type_cd}"></span></td>
+ <td><span class="sprite sprite-${rg.game_type_cd}" alt="${rg.game_type_cd}" title="${rg.game_type_descr}"></span></td>
<td><a href="${request.route_url('server_info', id=rg.server_id)}" title="Go to the detail page for this server">${rg.server_name}</a></td>
<td><a href="${request.route_url('map_info', id=rg.map_id)}" title="Go to the map detail page for this map">${rg.map_name}</a></td>
<td><span class="abstime" data-epoch="${rg.epoch}" title="${rg.start_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${rg.fuzzy_date}</span></td>
% for rg in recent_games:
<tr>
<td><a class="btn btn-primary btn-small" href="${request.route_url('game_info', id=rg.game_id)}" title="View detailed information about this game">View</a></td>
- <td><span class="sprite sprite-${rg.game_type_cd}" alt="${rg.game_type_cd}"></span></td>
+ <td><span class="sprite sprite-${rg.game_type_cd}" alt="${rg.game_type_cd}" title="${rg.game_type_descr}"></span></td>
<td><a href="${request.route_url('server_info', id=rg.server_id)}" title="Go to the detail page for this server">${rg.server_name}</a></td>
<td><span class="abstime" data-epoch="${rg.epoch}" title="${rg.start_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${rg.fuzzy_date}</span></td>
<td>
% for rg in recent_games:
<tr>
<td class="tdcenter"><a class="btn btn-primary btn-small" href="${request.route_url('game_info', id=rg.game_id)}" title="View detailed information about this game">view</a></td>
- <td class="tdcenter"><span class="sprite sprite-${rg.game_type_cd}" alt="${rg.game_type_cd}"></span></td>
+ <td class="tdcenter"><span class="sprite sprite-${rg.game_type_cd}" alt="${rg.game_type_cd}" title="${rg.game_type_descr}"></span></td>
<td>${rg.server_name}</td>
<td>${rg.map_name}</td>
<td>
% for rg in recent_games:
<tr>
<td><a class="btn btn-primary btn-small" href="${request.route_url('game_info', id=rg.game_id)}" title="View detailed information about this game">View</a></td>
- <td><span class="sprite sprite-${rg.game_type_cd}" alt="${rg.game_type_cd}"></span></td>
+ <td><span class="sprite sprite-${rg.game_type_cd}" alt="${rg.game_type_cd}" title="${rg.game_type_descr}"></span></td>
<td><a href="${request.route_url('map_info', id=rg.map_id)}" title="Go to the map detail page for this map">${rg.map_name}</a></td>
<td><span class="abstime" data-epoch="${rg.epoch}" title="${rg.start_dt.strftime('%a, %d %b %Y %H:%M:%S UTC')}">${rg.fuzzy_date}</span></td>
<td>
else:
current_page = 1
- games_q = DBSession.query(Game, Server, Map).\
+ games_q = DBSession.query(Game, Server, Map, GameType).\
filter(Game.server_id == Server.server_id).\
filter(Game.map_id == Map.map_id).\
+ filter(Game.game_type_cd == GameType.game_type_cd).\
order_by(Game.game_id.desc())
games = Page(games_q, current_page, items_per_page=10, url=page_url)
pgstats = {}
- for (game, server, map) in games:
+ for (game, server, map, gametype) in games:
pgstats[game.game_id] = DBSession.query(PlayerGameStat).\
filter(PlayerGameStat.game_id == game.game_id).\
order_by(PlayerGameStat.scoreboardpos).\
try:
notfound = False
- (game, server, map) = DBSession.query(Game, Server, Map).\
+ (game, server, map, gametype) = DBSession.query(Game, Server, Map, GameType).\
filter(Game.game_id == game_id).\
filter(Game.server_id == Server.server_id).\
- filter(Game.map_id == Map.map_id).one()
+ filter(Game.map_id == Map.map_id).\
+ filter(Game.game_type_cd == GameType.game_type_cd).one()
pgstats = DBSession.query(PlayerGameStat).\
filter(PlayerGameStat.game_id == game_id).\
game = None
server = None
map = None
+ gametype = None
pgstats = None
pwstats = None
captimes = None
return {'game':game,
'server':server,
'map':map,
+ 'gametype':gametype,
'pgstats':pgstats,
'pwstats':pwstats,
'captimes':captimes,
The constructor takes a query row that has been fetched, and
it requires the following columns to be present in the row:
- game_id, game_type_cd, winner, start_dt, server_id, server_name,
- map_id, map_name, player_id, nick, rank, team
+ game_id, game_type_cd, game_type_descr, winner, start_dt,
+ server_id, server_name, map_id, map_name, player_id, nick,
+ rank, team
The following columns are optional:
def __init__(self, row):
self.game_id = row.game_id
self.game_type_cd = row.game_type_cd
+ self.game_type_descr = row.game_type_descr
self.winner = row.winner
self.start_dt = row.start_dt
self.fuzzy_date = pretty_date(row.start_dt)
return {
"game_id": self.game_id,
"game_type_cd": self.game_type_cd,
+ "game_type_descr": self.game_type_descr,
"winner": self.winner,
"start_dt": self.start_dt,
"fuzzy_dt": self.fuzzy_date,
look when querying. Only games that happened on or after the
cutoff (which is a datetime object) will be returned.
'''
- recent_games_q = DBSession.query(Game.game_id, Game.game_type_cd,
- Game.winner, Game.start_dt, Server.server_id,
- Server.name.label('server_name'), Map.map_id,
+ recent_games_q = DBSession.query(Game.game_id, GameType.game_type_cd,
+ Game.winner, Game.start_dt, GameType.descr.label('game_type_descr'),
+ Server.server_id, Server.name.label('server_name'), Map.map_id,
Map.name.label('map_name'), PlayerGameStat.player_id,
PlayerGameStat.nick, PlayerGameStat.rank, PlayerGameStat.team,
PlayerGameStat.elo_delta).\
filter(Game.server_id==Server.server_id).\
filter(Game.map_id==Map.map_id).\
filter(Game.game_id==PlayerGameStat.game_id).\
+ filter(Game.game_type_cd==GameType.game_type_cd).\
order_by(expr.desc(Game.game_id))
# the various filters provided get tacked on to the query