\r
log = logging.getLogger(__name__)\r
\r
+\r
+def is_blank_game(players):\r
+ """Determine if this is a blank game or not. A blank game is either:\r
+\r
+ 1) a match that ended in the warmup stage, where accuracy events are not\r
+ present\r
+\r
+ 2) a match in which no player made a positive or negative score AND was\r
+ on the scoreboard\r
+ """\r
+ flg_nonzero_score = False\r
+ flg_acc_events = False\r
+\r
+ for events in players:\r
+ if is_real_player(events):\r
+ for (key,value) in events.items():\r
+ if key == 'scoreboard-score' and value != '0':\r
+ flg_nonzero_score = True\r
+ if key.startswith('acc-'):\r
+ flg_acc_events = True\r
+\r
+ return flg_nonzero_score and flg_acc_events\r
+\r
def get_remote_addr(request):\r
"""Get the Xonotic server's IP address"""\r
if 'X-Forwarded-For' in request.headers:\r
log.debug("ERROR: Not enough real players")\r
raise pyramid.httpexceptions.HTTPOk("OK")\r
\r
+ if is_blank_game(players):\r
+ log.debug("ERROR: Blank game")\r
+ raise pyramid.httpexceptions.HTTPOk("OK")\r
+\r
# FIXME: if we have two players and game type is 'dm',\r
# change this into a 'duel' gametype. This should be\r
# removed when the stats actually send 'duel' instead of 'dm'\r