diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/ships.py | 8 | ||||
-rw-r--r-- | modules/task_type.py (renamed from modules/tasks.py) | 5 |
2 files changed, 9 insertions, 4 deletions
diff --git a/modules/ships.py b/modules/ships.py index 0a296ca..8dfe41a 100644 --- a/modules/ships.py +++ b/modules/ships.py @@ -1,4 +1,4 @@ -from . import tasks +from . import task_type from .database import cursor, conn @@ -13,15 +13,15 @@ class Ship: cursor.execute("SELECT task, params FROM ships WHERE symbol = ?", (self.symbol,)) row = cursor.fetchone() if row is None: - cursor.execute("INSERT INTO ships (symbol, task, params) VALUES (?, ?, ?)", (self.symbol, tasks.IDLE, None)) + cursor.execute("INSERT INTO ships (symbol, task, params) VALUES (?, ?, ?)", (self.symbol, task_type.IDLE, None)) conn.commit() - self.task = tasks.IDLE + self.task = task_type.IDLE else: self.task = row[0] def set_task(self, task): self.task = task - if task != tasks.ERROR: + if task != task_type.ERROR: cursor.execute("UPDATE ships SET task = ? WHERE symbol = ?", (task, self.symbol)) conn.commit() diff --git a/modules/tasks.py b/modules/task_type.py index 8479134..7579ad0 100644 --- a/modules/tasks.py +++ b/modules/task_type.py @@ -3,3 +3,8 @@ MINING = 'MINING' MIA = 'MIA' ERROR = 'ERROR' + +task_types = [ + IDLE, + MINING, +] |