From b244640288648f27ce1fc7be3f175703e0a3412b Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 6 Jun 2020 09:07:42 +0200 Subject: Add menu options to update tasks status --- src/db/tasks.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/db') diff --git a/src/db/tasks.py b/src/db/tasks.py index dca7710..efb88d6 100644 --- a/src/db/tasks.py +++ b/src/db/tasks.py @@ -90,8 +90,14 @@ def update(cursor: Cursor, task: Task, form: ValidTaskForm): description = form.description ) -def delete(cursor: Cursor, ids): +def delete(cursor: Cursor, ids: List[int]): if len(ids) >= 1: cursor.execute( "DELETE FROM tasks WHERE id IN (%s)" % ",".join("?"*len(ids)), ids) + +def update_status(cursor: Cursor, ids: List[int], s: Status): + if len(ids) >= 1: + cursor.execute( + "UPDATE tasks SET status = ? WHERE id IN (%s)" % ",".join("?"*len(ids)), + [status.format(s)] + ids) -- cgit v1.2.3