diff options
author | Joris | 2020-05-31 13:59:35 +0200 |
---|---|---|
committer | Joris | 2020-05-31 13:59:35 +0200 |
commit | 0f1610333324d58acafee8c0fa9d9c9bc293b219 (patch) | |
tree | 302c37dd3751e9fe2e50ab656d56253bfd2d55fc /src/db/tasks.py | |
parent | 8a6e10d401eea8db0947f8c4b309b8a6256f9748 (diff) | |
download | todo-0f1610333324d58acafee8c0fa9d9c9bc293b219.tar.gz todo-0f1610333324d58acafee8c0fa9d9c9bc293b219.tar.bz2 todo-0f1610333324d58acafee8c0fa9d9c9bc293b219.zip |
Use defined tags for tasks
Diffstat (limited to 'src/db/tasks.py')
-rw-r--r-- | src/db/tasks.py | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/db/tasks.py b/src/db/tasks.py index 29d3ba6..b72965b 100644 --- a/src/db/tasks.py +++ b/src/db/tasks.py @@ -1,9 +1,10 @@ from sqlite3 import Cursor import time +from typing import List from model.task import Task, ValidTaskForm -def get(cursor: Cursor) -> Task: +def get(cursor: Cursor) -> List[Task]: cursor.execute( " SELECT" " id," @@ -11,7 +12,6 @@ def get(cursor: Cursor) -> Task: " updated_at," " name," " duration," - " tag," " difficulty," " priority," " description" @@ -26,10 +26,9 @@ def get(cursor: Cursor) -> Task: updated_at = task[2], name = task[3], duration = task[4], - tag = task[5], - difficulty = task[6], - priority = task[7], - description = task[8] + difficulty = task[5], + priority = task[6], + description = task[7] )) return res @@ -42,12 +41,11 @@ def insert(cursor: Cursor, form: ValidTaskForm): " updated_at," " name," " duration," - " tag," " difficulty," " priority," " description" - " ) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", - (now, now, form.name, form.duration, form.tag, int(form.difficulty), int(form.priority), form.description)) + " ) VALUES (?, ?, ?, ?, ?, ?, ?)", + (now, now, form.name, form.duration, int(form.difficulty), int(form.priority), form.description)) return Task( id = cursor.lastrowid, @@ -55,7 +53,6 @@ def insert(cursor: Cursor, form: ValidTaskForm): updated_at = now, name = form.name, duration = form.duration, - tag = form.tag, difficulty = form.difficulty, priority = form.priority, description = form.description @@ -69,12 +66,11 @@ def update(cursor: Cursor, task: Task, form: ValidTaskForm): " updated_at = ?," " name = ?," " duration = ?," - " tag = ?," " difficulty = ?," " priority = ?," " description = ?" " WHERE id = ?", - (now, form.name, form.duration, form.tag, int(form.difficulty), int(form.priority), form.description, task.id)) + (now, form.name, form.duration, int(form.difficulty), int(form.priority), form.description, task.id)) return Task( id = task.id, @@ -82,7 +78,6 @@ def update(cursor: Cursor, task: Task, form: ValidTaskForm): updated_at = now, name = form.name, duration = form.duration, - tag = form.tag, difficulty = form.difficulty, priority = form.priority, description = form.description |