From: Ant Zucaro Date: Sat, 21 May 2011 20:37:10 +0000 (-0400) Subject: Use description value in cd_weapon when displaying weapon stats. This avoids weird... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1c304d828cd7dc79ee6c6f43bed5fb8f89825eb1;p=xonotic%2Fxonstat.git Use description value in cd_weapon when displaying weapon stats. This avoids weird sorting by things like "grenadelauncher" when the weapon is being displayed as "Mortar". --- diff --git a/xonstat/templates/player_weapon_stats.mako b/xonstat/templates/player_weapon_stats.mako index 1a499f1..9812b35 100644 --- a/xonstat/templates/player_weapon_stats.mako +++ b/xonstat/templates/player_weapon_stats.mako @@ -21,9 +21,9 @@ Accuracy Information - ${parent.title()} Frags -% for pwstat in pwstats: +% for (pwstat, weapon) in pwstats: - ${pwstat.weapon_cd} + ${weapon.descr} ${pwstat.fired} ${pwstat.hit} ${pwstat.max} diff --git a/xonstat/views.py b/xonstat/views.py index b78d97c..e5fc599 100755 --- a/xonstat/views.py +++ b/xonstat/views.py @@ -82,10 +82,11 @@ def player_weapon_stats(request): game_id = request.matchdict['game_id'] pgstat_id = request.matchdict['pgstat_id'] try: - pwstats = DBSession.query(PlayerWeaponStat).\ + pwstats = DBSession.query(PlayerWeaponStat, Weapon).\ + filter(PlayerWeaponStat.weapon_cd==Weapon.weapon_cd).\ filter_by(game_id=game_id).\ filter_by(player_game_stat_id=pgstat_id).\ - order_by(PlayerWeaponStat.weapon_cd).\ + order_by(Weapon.descr).\ all() except Exception as e: