mirror of
https://git.wownero.com/wownero/tippero.git
synced 2024-08-15 00:33:14 +00:00
rainactive: fix issue with link objects not usable as keys in a dict
This commit is contained in:
parent
b181b19c16
commit
8a81397a84
1 changed files with 4 additions and 4 deletions
|
@ -248,7 +248,7 @@ def RainActive(link,cmd):
|
||||||
l=Link(link.network,User(link.network,NickFromIdentity(i)),group)
|
l=Link(link.network,User(link.network,NickFromIdentity(i)),group)
|
||||||
if l in userlist:
|
if l in userlist:
|
||||||
userlist.remove(l)
|
userlist.remove(l)
|
||||||
weights=dict()
|
weights=[]
|
||||||
weight=0
|
weight=0
|
||||||
log_log('userlist to loop: %s' % str([user.identity() for user in userlist]))
|
log_log('userlist to loop: %s' % str([user.identity() for user in userlist]))
|
||||||
for n in userlist:
|
for n in userlist:
|
||||||
|
@ -259,7 +259,7 @@ def RainActive(link,cmd):
|
||||||
dt = now - t
|
dt = now - t
|
||||||
if dt <= seconds:
|
if dt <= seconds:
|
||||||
w = (1 * (seconds - dt) + minfrac * dt) / (seconds)
|
w = (1 * (seconds - dt) + minfrac * dt) / (seconds)
|
||||||
weights[n] = w
|
weights.append((n, w))
|
||||||
weight += w
|
weight += w
|
||||||
|
|
||||||
if len(weights) == 0:
|
if len(weights) == 0:
|
||||||
|
@ -276,8 +276,8 @@ def RainActive(link,cmd):
|
||||||
nnicks = 0
|
nnicks = 0
|
||||||
minu=None
|
minu=None
|
||||||
maxu=None
|
maxu=None
|
||||||
for n in weights:
|
for n,w in weights:
|
||||||
user_units = long(units * weights[n] / weight)
|
user_units = long(units * w / weight)
|
||||||
if user_units <= 0:
|
if user_units <= 0:
|
||||||
continue
|
continue
|
||||||
act = now - link.network.get_last_active_time(n.user.nick,link.group.name)
|
act = now - link.network.get_last_active_time(n.user.nick,link.group.name)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue