Fix tempban sanction not working

This commit is contained in:
skizzerz 2016-08-19 23:46:13 -05:00
parent ac78e46e91
commit 1fdd9250d6
2 changed files with 9 additions and 9 deletions

View File

@ -739,16 +739,16 @@ def expire_tempbans():
WHERE WHERE
(bt.expires IS NOT NULL AND bt.expires < datetime('now')) (bt.expires IS NOT NULL AND bt.expires < datetime('now'))
OR ( OR (
warning_amount IS NOT NULL bt.warning_amount IS NOT NULL
AND warning_amount <= ( AND bt.warning_amount >= (
SELECT COALESCE(SUM(amount), 0) SELECT COALESCE(SUM(w.amount), 0)
FROM warning FROM warning w
WHERE WHERE
target = pl.person w.target = pl.person
AND deleted = 0 AND w.deleted = 0
AND ( AND (
expires IS NULL w.expires IS NULL
OR expires > datetime('now') OR w.expires > datetime('now')
) )
) )
)""") )""")

View File

@ -159,7 +159,7 @@ def add_warning(cli, target, amount, actor, reason, notes=None, expires=None, sa
# within each category, a larger set time or a lower threshold takes precedence # within each category, a larger set time or a lower threshold takes precedence
exp = None exp = None
ths = None ths = None
if sanc["tempban"][-1] in ("d", "h", "m"): if isinstance(sanc["tempban"], str) and sanc["tempban"][-1] in ("d", "h", "m"):
amt = int(sanc["tempban"][:-1]) amt = int(sanc["tempban"][:-1])
dur = sanc["tempban"][-1] dur = sanc["tempban"][-1]
if dur == "d": if dur == "d":