From 8a81397a842ca61e015255a3abd93482a66e5de6 Mon Sep 17 00:00:00 2001 From: moneromooo Date: Sun, 1 Feb 2015 15:51:08 +0000 Subject: [PATCH] rainactive: fix issue with link objects not usable as keys in a dict --- tipbot/modules/tipping.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tipbot/modules/tipping.py b/tipbot/modules/tipping.py index b01fbe4..dd4d994 100644 --- a/tipbot/modules/tipping.py +++ b/tipbot/modules/tipping.py @@ -248,7 +248,7 @@ def RainActive(link,cmd): l=Link(link.network,User(link.network,NickFromIdentity(i)),group) if l in userlist: userlist.remove(l) - weights=dict() + weights=[] weight=0 log_log('userlist to loop: %s' % str([user.identity() for user in userlist])) for n in userlist: @@ -259,7 +259,7 @@ def RainActive(link,cmd): dt = now - t if dt <= seconds: w = (1 * (seconds - dt) + minfrac * dt) / (seconds) - weights[n] = w + weights.append((n, w)) weight += w if len(weights) == 0: @@ -276,8 +276,8 @@ def RainActive(link,cmd): nnicks = 0 minu=None maxu=None - for n in weights: - user_units = long(units * weights[n] / weight) + for n,w in weights: + user_units = long(units * w / weight) if user_units <= 0: continue act = now - link.network.get_last_active_time(n.user.nick,link.group.name)