]> de.git.xonotic.org Git - xonotic/xonstat.git/commitdiff
Add is_real_player function.
authorAnt Zucaro <azucaro@gmail.com>
Tue, 18 Oct 2011 22:10:15 +0000 (18:10 -0400)
committerAnt Zucaro <azucaro@gmail.com>
Tue, 18 Oct 2011 22:10:15 +0000 (18:10 -0400)
xonstat/views/submission.py

index ba3cfc9620511b359e88d8010ec6f3e99494da63..3b8f8a02f491fa6e82b87fe65fa0b416f9262ce3 100755 (executable)
@@ -9,6 +9,16 @@ from xonstat.util import strip_colors
 \r
 log = logging.getLogger(__name__)\r
 \r
+def is_real_player(events):\r
+    flg_is_real = False\r
+\r
+    if not events['P'].startswith('bot'):\r
+        # removing 'joins' here due to bug, but it should be here\r
+        if 'matches' in events and 'scoreboardvalid' in events:\r
+            flg_is_real = True\r
+\r
+    return flg_is_real\r
+\r
 \r
 def register_new_nick(session, player, new_nick):\r
     """\r
@@ -381,12 +391,9 @@ def stats_submit(request):
             raise Exception("Required game meta fields (T, G, M, or S) missing.")\r
     \r
         real_players = 0\r
-        for player_events in players:\r
-            if not player_events['P'].startswith('bot'):\r
-                # removing 'joins' here due to bug, but it should be here\r
-                if 'matches' in player_events\\r
-                    and 'scoreboardvalid' in player_events:\r
-                    real_players += 1\r
+        for events in players:\r
+            if is_real_player(events):\r
+                real_players += 1\r
 \r
         #TODO: put this into a config setting in the ini file?\r
         if real_players < 1:\r