summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-01-30 15:48:41 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-01-30 15:48:41 +0000
commitd2151e2f9a6e247aae7f7fd0cb04da8be16cadff (patch)
tree6aa3691426efed6e9ae0b19cb40dcb67b1db7726
parent8083085044a2cdae0e9d30e0b37ca449f65f4692 (diff)
downloadlorry-controller-d2151e2f9a6e247aae7f7fd0cb04da8be16cadff.tar.gz
Make StateDB.get_running_queue return actual booleans
-rwxr-xr-xlorry-controller-webapp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lorry-controller-webapp b/lorry-controller-webapp
index 3963853..884a3f5 100755
--- a/lorry-controller-webapp
+++ b/lorry-controller-webapp
@@ -71,12 +71,16 @@ class StateDB(object):
self._open()
c = self._conn.cursor()
for (running,) in c.execute('SELECT running FROM running_queue'):
- return running
+ return bool(running)
def set_running_queue(self, new_status):
+ if new_status:
+ new_value = 1
+ else:
+ new_value = 0
self._open()
c = self._conn.cursor()
- c.execute('UPDATE running_queue SET running = ?', str(new_status))
+ c.execute('UPDATE running_queue SET running = ?', str(new_value))
self._conn.commit()