Fix tempban sanction not working
This commit is contained in:
parent
ac78e46e91
commit
1fdd9250d6
16
src/db.py
16
src/db.py
@ -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')
|
||||
)
|
||||
)
|
||||
)""")
|
||||
|
@ -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":
|
||||
|
Loading…
x
Reference in New Issue
Block a user