]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
Add logic to identify fastest caps or laps by humans.
authorAnt Zucaro <azucaro@gmail.com>
Sat, 4 Feb 2017 16:40:26 +0000 (11:40 -0500)
committerAnt Zucaro <azucaro@gmail.com>
Sat, 4 Feb 2017 16:40:26 +0000 (11:40 -0500)
This also helps to identify blank games easier.

xonstat/views/submission.py

index 14847ad920be2b8bc5c9b985abf0f128bf33881f..20e20f95325b0dd305721d4f64f0e454ddfb9789 100644 (file)
@@ -109,6 +109,9 @@ class Submission(object):
         # does any human have a non-zero score?
         self.human_nonzero_score = False
 
+        # does any human have a fastest cap?
+        self.human_fastest = False
+
     def next_item(self):
         """Returns the next key:value pair off the queue."""
         try:
@@ -138,6 +141,7 @@ class Submission(object):
 
         player_fired_weapon = False
         player_nonzero_score = False
+        player_fastest = False
 
         # Consume all following 'i' 'n' 't'  'e' records
         while len(self.q) > 0:
@@ -153,6 +157,8 @@ class Submission(object):
                     self.check_for_new_weapon_fired(sub_key)
                 elif sub_key == 'scoreboard-score' and int(value) != 0:
                     player_nonzero_score = True
+                elif sub_key == 'scoreboard-fastest':
+                    player_fastest = True
             elif key == 'n':
                 player[key] = unicode(value, 'utf-8')
             elif key in player_keys:
@@ -174,6 +180,9 @@ class Submission(object):
             if player_nonzero_score:
                 self.human_nonzero_score = True
 
+            if player_fastest:
+                self.human_fastest = True
+
         elif played and not human:
             self.bots.append(player)
         else: