Store entries for all players, just human players, and just bot players.
authorAnt Zucaro <azucaro@gmail.com>
Wed, 1 Feb 2017 11:57:07 +0000 (06:57 -0500)
committerAnt Zucaro <azucaro@gmail.com>
Wed, 1 Feb 2017 11:57:07 +0000 (06:57 -0500)
xonstat/views/submission.py

index 1526acf..ab75cf0 100644 (file)
@@ -50,18 +50,21 @@ class Submission(object):
         # game metadata
         self.meta = {}
 
-        # raw player events
+        # humans and bots in the match (including spectators)
         self.players = []
 
+        # humans who played in the match
+        self.humans = []
+
+        # bots who played in the match
+        self.bots = []
+
         # raw team events
         self.teams = []
 
         # distinct weapons that we have seen fired
         self.weapons = set()
 
-        # number of real players in the match
-        self.real_players = 0
-
         # the parsing deque (we use this to allow peeking)
         self.q = collections.deque(self.body.split("\n"))
 
@@ -113,10 +116,14 @@ class Submission(object):
                 self.q.appendleft("{} {}".format(key, value))
                 break
 
-        if is_real_player(player) and played_in_game(player):
-            self.real_players += 1
-
-        self.players.append(player)
+        played = played_in_game(player)
+        human = is_real_player(player)
+        if played and human:
+            self.humans.append(player)
+        elif played and not human:
+            self.bots.append(player)
+        else:
+            self.players.append(player)
 
     def parse_team(self, key, tid):
         """Construct a team events listing from the submission."""