From: Ant Zucaro Date: Sat, 13 Dec 2014 03:40:00 +0000 (-0500) Subject: Convert old weapon names to new ones at submission time. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7a808ecb4b8eff2d93ce2f99750dcd5e701875f0;p=xonotic%2Fxonstat.git Convert old weapon names to new ones at submission time. --- 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()