summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBotond Hende <nettingman@gmail.com>2024-09-01 00:27:54 +0200
committerBotond Hende <nettingman@gmail.com>2024-09-01 00:27:54 +0200
commite66fb136c8fd10fe8bafb273c938a3d332d997ba (patch)
tree94623092ecb1bb6177ecc7b922aeaec429cc08d3 /modules
parent21019bc8414e60495573807b0fe0eb562a0e8876 (diff)
setting tasks for ships
Diffstat (limited to 'modules')
-rw-r--r--modules/ships.py8
-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,
+]