]> de.git.xonotic.org Git - xonotic/xonstat.git/blobdiff - xonstat/views.py
Make player_weapon_stat parsing more clear.
[xonotic/xonstat.git] / xonstat / views.py
index 73ea718ecd8ef14799d763cd6f4f09f9cea76855..cb0da9a5d0862cbdb13640e3c50d363ee7e2e8a3 100755 (executable)
@@ -174,19 +174,19 @@ def create_player_weapon_stats(session=None, player=None,
     pwstats = []
 
     for (key,value) in player_events.items():
-        match = re.search("acc-(.*?)-cnt-fired", key)
-        if match:
-            abbr = match.group(1)
+        matched = re.search("acc-(.*?)-cnt-fired", key)
+        if matched:
+            weapon_cd = match.group(1)
             try:
                 pwstat = PlayerWeaponStat()
                 pwstat.player_id = player.player_id
                 pwstat.game_id = game.game_id
-                pwstat.weapon_cd = abbr
-                pwstat.max = player_events['acc-' + abbr + '-fired']
-                pwstat.actual = player_events['acc-' + abbr + '-hit']
-                pwstat.fired = player_events['acc-' + abbr + '-cnt-fired']
-                pwstat.hit = player_events['acc-' + abbr + '-cnt-hit']
-                pwstat.frags = player_events['acc-' + abbr + '-frags']
+                pwstat.weapon_cd = weapon_cd
+                pwstat.max = player_events['acc-' + weapon_cd + '-fired']
+                pwstat.actual = player_events['acc-' + weapon_cd + '-hit']
+                pwstat.fired = player_events['acc-' + weapon_cd + '-cnt-fired']
+                pwstat.hit = player_events['acc-' + weapon_cd + '-cnt-hit']
+                pwstat.frags = player_events['acc-' + weapon_cd + '-frags']
                 session.add(pwstat)
                 pwstats.append(pwstat)
             except: