From 7a808ecb4b8eff2d93ce2f99750dcd5e701875f0 Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Fri, 12 Dec 2014 22:40:00 -0500 Subject: [PATCH] Convert old weapon names to new ones at submission time. --- xonstat/views/submission.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/xonstat/views/submission.py b/xonstat/views/submission.py index 1a3630c..dc5fa03 100644 --- a/xonstat/views/submission.py +++ b/xonstat/views/submission.py @@ -10,7 +10,7 @@ from sqlalchemy import Sequence from sqlalchemy.orm.exc import MultipleResultsFound, NoResultFound from xonstat.elo import process_elos from xonstat.models import * -from xonstat.util import strip_colors, qfont_decode, verify_request +from xonstat.util import strip_colors, qfont_decode, verify_request, weapon_map log = logging.getLogger(__name__) @@ -757,6 +757,11 @@ def create_weapon_stats(session, game_meta, game, player, pgstat, events): matched = re.search("acc-(.*?)-cnt-fired", key) if matched: weapon_cd = matched.group(1) + + # Weapon names changed for 0.8. We'll convert the old + # ones to use the new scheme as well. + weapon_cd = weapon_map.get(weapon_cd, weapon_cd) + seq = Sequence('player_weapon_stats_player_weapon_stats_id_seq') pwstat_id = session.execute(seq) pwstat = PlayerWeaponStat() -- 2.39.2