diff options
author | Joris | 2020-05-10 11:07:12 +0200 |
---|---|---|
committer | Joris | 2020-05-10 11:07:12 +0200 |
commit | a134f20eb62e6d174e7da81fd4adb7ff9e8b3b71 (patch) | |
tree | fe4b98d4a4636f20f28a5a7e5011a73171a2d182 /src/db | |
parent | e33a5e7aff3143c50813fee7c12f10f98d132240 (diff) |
Add task description field
Diffstat (limited to 'src/db')
-rw-r--r-- | src/db/init.py | 1 | ||||
-rw-r--r-- | src/db/tasks.py | 16 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/db/init.py b/src/db/init.py index c1835eb..cb8a4a8 100644 --- a/src/db/init.py +++ b/src/db/init.py @@ -12,6 +12,7 @@ def init(path): " created_at INTEGER NOT NULL," " modified_at INTEGER NOT NULL," " name TEXT NOT NULL," + " description TEXT," " duration INTEGER," " tag TEXT" " )") diff --git a/src/db/tasks.py b/src/db/tasks.py index d03877b..e22a315 100644 --- a/src/db/tasks.py +++ b/src/db/tasks.py @@ -10,6 +10,7 @@ def get(cursor: Cursor) -> Task: " created_at," " modified_at," " name," + " description," " duration," " tag" " FROM tasks") @@ -22,8 +23,9 @@ def get(cursor: Cursor) -> Task: created_at = task[1], modified_at = task[2], name = task[3], - duration = task[4], - tag = task[5] + description = task[4], + duration = task[5], + tag = task[6] )) return res @@ -35,16 +37,18 @@ def insert(cursor: Cursor, form: ValidTaskForm): " created_at," " modified_at," " name," + " description," " duration," " tag" - " ) VALUES (?, ?, ?, ?, ?)", - (now, now, form.name, form.duration, form.tag)) + " ) VALUES (?, ?, ?, ?, ?, ?)", + (now, now, form.name, form.description, form.duration, form.tag)) return Task( id = cursor.lastrowid, created_at = now, modified_at = now, name = form.name, + description = form.description, duration = form.duration, tag = form.tag ) @@ -57,16 +61,18 @@ def update(cursor: Cursor, task: Task, form: ValidTaskForm): " SET" " modified_at = ?," " name = ?," + " description = ?," " duration = ?," " tag = ?" " WHERE id = ?", - (now, form.name, form.duration, form.tag, task.id)) + (now, form.name, form.description, form.duration, form.tag, 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 ) |