elstat.alerts: use ints instead of bool queries

This commit is contained in:
Luna Mendes 2018-09-26 03:58:53 -03:00
parent 867d7d1e69
commit 37724f2d21

View file

@ -43,7 +43,7 @@ class DiscordAlert:
# find the last work that had a success # find the last work that had a success
cur.execute(f""" cur.execute(f"""
SELECT timestamp FROM {worker.name} SELECT timestamp FROM {worker.name}
WHERE timestamp < ? AND status = true WHERE timestamp < ? AND status = 1
ORDER BY timestamp DESC ORDER BY timestamp DESC
LIMIT 1 LIMIT 1
""", (status['timestamp'], )) """, (status['timestamp'], ))
@ -54,7 +54,7 @@ class DiscordAlert:
# now we fetch all the downtime after that ts_success # now we fetch all the downtime after that ts_success
cur.execute(f""" cur.execute(f"""
SELECT COUNT(*) FROM {worker.name} SELECT COUNT(*) FROM {worker.name}
WHERE timestamp > ? AND status = false WHERE timestamp > ? AND status = 0
""", (ts_success,)) """, (ts_success,))
row = cur.fetchone() row = cur.fetchone()