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
(bt.expires IS NOT NULL AND bt.expires < datetime('now'))
OR (
warning_amount IS NOT NULL
AND warning_amount <= (
SELECT COALESCE(SUM(amount), 0)
FROM warning
bt.warning_amount IS NOT NULL
AND bt.warning_amount >= (
SELECT COALESCE(SUM(w.amount), 0)
FROM warning w
WHERE
target = pl.person
AND deleted = 0
w.target = pl.person
AND w.deleted = 0
AND (
expires IS NULL
OR expires > datetime('now')
w.expires IS NULL
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
exp = 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])
dur = sanc["tempban"][-1]
if dur == "d":