From 1fdd9250d6481152500141b3a3ce082728221b4a Mon Sep 17 00:00:00 2001 From: skizzerz Date: Fri, 19 Aug 2016 23:46:13 -0500 Subject: [PATCH] Fix tempban sanction not working --- src/db.py | 16 ++++++++-------- src/warnings.py | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/db.py b/src/db.py index ad16b27..d7aaa65 100644 --- a/src/db.py +++ b/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') ) ) )""") diff --git a/src/warnings.py b/src/warnings.py index d9d113e..f7572f9 100644 --- a/src/warnings.py +++ b/src/warnings.py @@ -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":