From 4c76c9f61648c9453600eda1f274e14ecd0e4764 Mon Sep 17 00:00:00 2001 From: moneromooo Date: Thu, 1 Jan 2015 15:18:42 +0000 Subject: [PATCH] Fix rainactive minfrac formula --- tipbot/modules/tipping.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tipbot/modules/tipping.py b/tipbot/modules/tipping.py index f45cc60..551c7ef 100644 --- a/tipbot/modules/tipping.py +++ b/tipbot/modules/tipping.py @@ -163,6 +163,7 @@ def RainActive(nick,chan,cmd): hours=float(hours) if hours <= 0: raise RuntimeError("") + seconds = hours * 3600 except Exception,e: SendTo(chan, "Invalid hours") return @@ -200,8 +201,8 @@ def RainActive(nick,chan,cmd): if t == None: continue dt = now - t - if dt <= hours * 3600: - w = (1 * (hours * 3600 - dt) + minfrac * (1 - (hours * 3600 - dt))) / (hours * 3600) + if dt <= seconds: + w = (1 * (seconds - dt) + minfrac * dt) / (seconds) weights[n] = w weight += w