diff options
author | Joris | 2020-05-31 17:39:28 +0200 |
---|---|---|
committer | Joris | 2020-05-31 17:39:28 +0200 |
commit | 1bed85a9b107d1b03e71b848829cb7b1f33060f4 (patch) | |
tree | 7e9bc7dd0813b9426e293dde7913717746a479f8 /src/service | |
parent | a585e507cbe2c05cc846013cafe433953e514295 (diff) |
Prevent removing a tag being used
Diffstat (limited to 'src/service')
-rw-r--r-- | src/service/tasks.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/service/tasks.py b/src/service/tasks.py index 6c3444b..870002a 100644 --- a/src/service/tasks.py +++ b/src/service/tasks.py @@ -10,18 +10,18 @@ def get(cursor) -> List[Task]: def create(cursor, task_form: ValidTaskForm) -> Task: task = db.tasks.insert(cursor, task_form) - new_task_tags = db.task_tags.insert_many(cursor, task.id, task_form.tags) + db.task_tags.insert_many(cursor, task.id, task_form.tags) database.commit() return task def update(cursor, task: Task, task_form: ValidTaskForm) -> Task: - updated_task = db.tasks.update(cursor, task, task_form) db.task_tags.delete(cursor, [task.id]) - new_task_tags = db.task_tags.insert_many(cursor, task.id, task_form.tags) + updated_task = db.tasks.update(cursor, task, task_form) + db.task_tags.insert_many(cursor, task.id, task_form.tags) database.commit() return updated_task def delete(cursor, task_ids: List[int]): - db.tasks.delete(cursor, task_ids) db.task_tags.delete(cursor, task_ids) + db.tasks.delete(cursor, task_ids) database.commit() |