From 02d2cfbd0df62cf8d9fc2bb54d1046a9e6c45378 Mon Sep 17 00:00:00 2001 From: schneefux Date: Tue, 20 Jun 2017 14:00:20 +0200 Subject: do not write to participant on rejected matches --- worker.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'worker.py') diff --git a/worker.py b/worker.py index 1fd18f7..47e7d95 100644 --- a/worker.py +++ b/worker.py @@ -153,11 +153,22 @@ def process(): matchup = [] anyAfk = False for roster in match.rosters: - team = [] for participant in roster.participants: if participant.went_afk == 1: anyAfk = True break + if len(match.rosters) < 2: + logging.error("got an invalid matchup %s", match.api_id) + match.trueskill_quality = 0 + continue + if anyAfk: + logging.error("got an afk matchup %s", match.api_id) + match.trueskill_quality = 0 + continue + + for roster in match.rosters: + team = [] + for participant in roster.participants: player = participant.player[0] mu = participant.trueskill_mu or player.trueskill_mu sigma = participant.trueskill_sigma or player.trueskill_sigma or 500 @@ -173,10 +184,6 @@ def process(): team.append(env.create_rating(float(mu), float(sigma))) matchup.append(team) - if len(matchup) != 2 or anyAfk == True: - logging.error("got an invalid matchup %s", match.api_id) - match.trueskill_quality = 0 - continue logging.info("got a valid matchup %s", match.api_id) # store the fairness of the match -- cgit v1.3.1