]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
Convert old weapon names to new ones at submission time.
authorAnt Zucaro <azucaro@gmail.com>
Sat, 13 Dec 2014 03:40:00 +0000 (22:40 -0500)
committerAnt Zucaro <azucaro@gmail.com>
Sat, 13 Dec 2014 03:40:00 +0000 (22:40 -0500)
xonstat/views/submission.py

index 1a3630c9a0c5954eb6912903b905411e51dab726..dc5fa03ebf2a4b2e565214fc590ab87701ff04fb 100644 (file)
@@ -10,7 +10,7 @@ from sqlalchemy import Sequence
 from sqlalchemy.orm.exc import MultipleResultsFound, NoResultFound\r
 from xonstat.elo import process_elos\r
 from xonstat.models import *\r
-from xonstat.util import strip_colors, qfont_decode, verify_request\r
+from xonstat.util import strip_colors, qfont_decode, verify_request, weapon_map\r
 \r
 \r
 log = logging.getLogger(__name__)\r
@@ -757,6 +757,11 @@ def create_weapon_stats(session, game_meta, game, player, pgstat, events):
         matched = re.search("acc-(.*?)-cnt-fired", key)\r
         if matched:\r
             weapon_cd = matched.group(1)\r
+\r
+            # Weapon names changed for 0.8. We'll convert the old\r
+            # ones to use the new scheme as well.\r
+            weapon_cd = weapon_map.get(weapon_cd, weapon_cd)\r
+\r
             seq = Sequence('player_weapon_stats_player_weapon_stats_id_seq')\r
             pwstat_id = session.execute(seq)\r
             pwstat = PlayerWeaponStat()\r