aboutsummaryrefslogtreecommitdiff
path: root/src/db/tasks.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/db/tasks.py')
-rw-r--r--src/db/tasks.py44
1 files changed, 28 insertions, 16 deletions
diff --git a/src/db/tasks.py b/src/db/tasks.py
index e22a315..5fdd25e 100644
--- a/src/db/tasks.py
+++ b/src/db/tasks.py
@@ -10,9 +10,11 @@ def get(cursor: Cursor) -> Task:
" created_at,"
" modified_at,"
" name,"
- " description,"
" duration,"
- " tag"
+ " tag,"
+ " difficulty,"
+ " priority,"
+ " description"
" FROM tasks")
res = []
@@ -23,9 +25,11 @@ def get(cursor: Cursor) -> Task:
created_at = task[1],
modified_at = task[2],
name = task[3],
- description = task[4],
- duration = task[5],
- tag = task[6]
+ duration = task[4],
+ tag = task[5],
+ difficulty = task[6],
+ priority = task[7],
+ description = task[8]
))
return res
@@ -37,20 +41,24 @@ def insert(cursor: Cursor, form: ValidTaskForm):
" created_at,"
" modified_at,"
" name,"
- " description,"
" duration,"
- " tag"
- " ) VALUES (?, ?, ?, ?, ?, ?)",
- (now, now, form.name, form.description, form.duration, form.tag))
+ " tag,"
+ " difficulty,"
+ " priority,"
+ " description"
+ " ) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
+ (now, now, form.name, form.duration, form.tag, int(form.difficulty), int(form.priority), form.description))
return Task(
id = cursor.lastrowid,
created_at = now,
modified_at = now,
name = form.name,
- description = form.description,
duration = form.duration,
- tag = form.tag
+ tag = form.tag,
+ difficulty = form.difficulty,
+ priority = form.priority,
+ description = form.description
)
def update(cursor: Cursor, task: Task, form: ValidTaskForm):
@@ -61,20 +69,24 @@ def update(cursor: Cursor, task: Task, form: ValidTaskForm):
" SET"
" modified_at = ?,"
" name = ?,"
- " description = ?,"
" duration = ?,"
- " tag = ?"
+ " tag = ?,"
+ " difficulty = ?,"
+ " priority = ?,"
+ " description = ?"
" WHERE id = ?",
- (now, form.name, form.description, form.duration, form.tag, task.id))
+ (now, form.name, form.duration, form.tag, int(form.difficulty), int(form.priority), form.description, task.id))
return Task(
id = task.id,
created_at = task.created_at,
modified_at = now,
name = form.name,
- description = form.description,
duration = form.duration,
- tag = form.tag
+ tag = form.tag,
+ difficulty = form.difficulty,
+ priority = form.priority,
+ description = form.description
)
def delete(cursor: Cursor, ids):