]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
Add check for scoreboardvalid in addition to joins and matches before creating game...
authorazucaro <azucaro@2QJ7BK1-RO.Org.Collegeboard.local>
Thu, 28 Apr 2011 12:54:16 +0000 (08:54 -0400)
committerazucaro <azucaro@2QJ7BK1-RO.Org.Collegeboard.local>
Thu, 28 Apr 2011 12:54:16 +0000 (08:54 -0400)
Store player rank in game stats.
Store player alivetime in game stats.

xonstat/views.py

index 5267e26c947dfa9f4f031a751da0625eaa67141b..a99e2eb4ef48312eedcc88d14e42b97a04f4fb32 100755 (executable)
@@ -144,6 +144,9 @@ def create_player_game_stat(session=None, player=None,
     for (key,value) in player_events.items():
         if key == 'n': pgstat.nick = value
         if key == 't': pgstat.team = value
+        if key == 'rank': pgstat.rank = value
+        if key == 'alivetime': 
+            pgstat.alivetime = datetime.timedelta(seconds=int(round(float(value))))
         if key == 'scoreboard-drops': pgstat.drops = value
         if key == 'scoreboard-returns': pgstat.returns = value
         if key == 'scoreboard-fckills': pgstat.carrier_frags = value
@@ -153,7 +156,6 @@ def create_player_game_stat(session=None, player=None,
         if key == 'scoreboard-deaths': pgstat.deaths = value
         if key == 'scoreboard-kills': pgstat.kills = value
         if key == 'scoreboard-suicides': pgstat.suicides = value
-        # TODO: alivetime
 
     # check to see if we had a name, and if 
     # not use the name from the player id
@@ -287,7 +289,8 @@ def stats_submit(request):
             has_real_players = True
         player = get_or_create_player(session=session, 
                 hashkey=player_events['P'])
-        if 'joins' in player_events and 'matches' in player_events:
+        if 'joins' in player_events and 'matches' in player_events\
+                 and 'scoreboardvalid' in player_events:
             pgstat = create_player_game_stat(session=session, 
                     player=player, game=game, player_events=player_events)
             #pwstats = create_player_weapon_stats(session=session,