rainactive: fix issue with link objects not usable as keys in a dict

This commit is contained in:
moneromooo 2015-02-01 15:51:08 +00:00
parent b181b19c16
commit 8a81397a84
1 changed files with 4 additions and 4 deletions

View File

@ -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)