From 5fd3546fc2788016e0c41dc596bcd7d0c4318ebe Mon Sep 17 00:00:00 2001 From: schneefux Date: Fri, 28 Jul 2017 11:38:42 +0200 Subject: fix session variable scope --- worker.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'worker.py') diff --git a/worker.py b/worker.py index a609bdd..9b0c9ef 100644 --- a/worker.py +++ b/worker.py @@ -52,7 +52,7 @@ timer = None def connect(): global Match, Roster, Participant, ParticipantStats, Player - global db, rabbit, channel + global Session, rabbit, channel # generate schema from db Base = automap_base() @@ -140,7 +140,7 @@ def try_process(): def process(): - global timer, queue, db + global timer, queue, Session logging.info("analyzing batch %s", str(len(queue))) ids = list(set([str(id, "utf-8") for _, _, id in queue])) @@ -187,13 +187,10 @@ def process(): 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 - if mu is None: - # no data -> approximate ts by VST - mu = vst_points[participant.skill_tier] + sigma - player.trueskill_mu = mu - player.trueskill_sigma = sigma + # no data -> approximate ts by VST + sigma = player.trueskill_sigma or 500 + mu = player.trueskill_mu or vst_points[participant.skill_tier] + sigma + # store pre match values participant.trueskill_mu = mu participant.trueskill_sigma = sigma -- cgit v1.3.1