renderer='game_index.mako')
# PLAYER ROUTES
+ config.add_route(name="player_weapon_stats",
+ pattern="/game/{game_id:\d+}/stats/{pgstat_id:\d+}",
+ view=player_weapon_stats, renderer='player_weapon_stats.mako')
+
config.add_route(name="player_game_index",
pattern="/player/{player_id:\d+}/games/page/{page:\d+}",
view=player_game_index, renderer='player_game_index.mako')
--- /dev/null
+<%inherit file="base.mako"/>
+
+<%block name="title">
+Accuracy Information - ${parent.title()}
+</%block>
+
+
+% if pwstats is None:
+<h2>Sorry, I can't find those weapon stats!</h2>
+<p>Assume the best, though. Really.</p>
+
+% else:
+<h2>Player Accuracy:</h2>
+<table border="1" cellpadding="3">
+ <tr>
+ <td>Weapon</td>
+ <td>Fired</td>
+ <td>Hit</td>
+ <td>Potential Damage</td>
+ <td>Actual Damage</td>
+ <td>Frags</td>
+ </tr>
+
+% for pwstat in pwstats:
+ <tr>
+ <td>${pwstat.weapon_cd}</td>
+ <td>${pwstat.fired}</td>
+ <td>${pwstat.hit}</td>
+ <td>${pwstat.max}</td>
+ <td>${pwstat.actual}</td>
+ <td>${pwstat.frags}</td>
+ </tr>
+% endfor
+</table>
+% endif
'games':games}
+def player_weapon_stats(request):
+ game_id = request.matchdict['game_id']
+ pgstat_id = request.matchdict['pgstat_id']
+ try:
+ pwstats = DBSession.query(PlayerWeaponStat).\
+ filter_by(game_id=game_id).\
+ filter_by(player_game_stat_id=pgstat_id).\
+ order_by(PlayerWeaponStat.weapon_cd).\
+ all()
+
+ except Exception as e:
+ pwstats = None
+ return {'pwstats':pwstats}
+
+
##########################################################################
# This is the game views area - only views pertaining to Xonotic
# games and their related information goes here