+++ /dev/null
-<%inherit file="base.mako"/>
-<%namespace file="accuracy.mako" import="accuracy" />
-
-<%block name="title">
-Accuracy Information - ${parent.title()}
-</%block>
-
-
-% if weapon_stats is None or pgstat is None or game is None:
-<h2>Sorry, I can't find those weapon stats!</h2>
-<p>Assume the best, though. Really.</p>
-
-% else:
-<h2>Player Accuracy for <a href="${request.route_url("player_info", id=pgstat.player_id)}" title="Info page for this player">${pgstat.nick_html_colors()}</a> in Game <a href="" title="">${game.game_id}</a>:</h2>
-
-## ACCURACY TABLE
-% if weapon_stats:
-${accuracy(weapon_stats)}
-% endif
-
-% endif
\r
return {'player':player,\r
'games':games}\r
-\r
-\r
-def player_weapon_stats(request):\r
- """\r
- List the accuracy statistics for the given player_id in a particular\r
- game.\r
- """\r
- game_id = request.matchdict['game_id']\r
- pgstat_id = request.matchdict['pgstat_id']\r
- try:\r
- pwstats = DBSession.query(PlayerWeaponStat, Weapon).\\r
- filter(PlayerWeaponStat.weapon_cd==Weapon.weapon_cd).\\r
- filter_by(game_id=game_id).\\r
- filter_by(player_game_stat_id=pgstat_id).\\r
- order_by(Weapon.descr).\\r
- all()\r
-\r
- # turn this into something the accuracy template can use\r
- weapon_stats = [(weapon.descr, pwstat.weapon_cd, pwstat.actual,\r
- pwstat.max, pwstat.hit, pwstat.fired) for (pwstat, weapon) in pwstats]\r
-\r
- pgstat = DBSession.query(PlayerGameStat).\\r
- filter_by(player_game_stat_id=pgstat_id).one()\r
-\r
- game = DBSession.query(Game).filter_by(game_id=game_id).one()\r
-\r
- except Exception as e:\r
- weapon_stats = None\r
- pgstat = None\r
- game = None\r
- return {'weapon_stats':weapon_stats, 'pgstat':pgstat, 'game':game}\r