From 1c304d828cd7dc79ee6c6f43bed5fb8f89825eb1 Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Sat, 21 May 2011 16:37:10 -0400 Subject: [PATCH] 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". --- xonstat/templates/player_weapon_stats.mako | 4 ++-- xonstat/views.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) 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: -- 2.39.2