X-Git-Url: https://apps.delaporte.us/gitweb/matrix-goal-bot.git/blobdiff_plain/2dfb9318625f70fd6838068d133e3dfe00000ac4..8958d1dc084e3d468e8880cafa29652754e99875:/matrix_goal_bot/db.py diff --git a/matrix_goal_bot/db.py b/matrix_goal_bot/db.py index bc8cdbc..6421d2b 100644 --- a/matrix_goal_bot/db.py +++ b/matrix_goal_bot/db.py @@ -204,9 +204,14 @@ class Data(): def remove_task(self, task_id): task_name = '' + logger.debug(f'Removing task with id {task_id}') with Session(self.engine) as session: - cmd = select(Task).where(Task.id == task_id) + cmd = select(Task).where(Task.id == int(task_id)) to_remove = session.exec(cmd).first() + if not to_remove: + return f'Unable to find task with id {task_id}' + + logger.debug(f'Removing task with name {to_remove.name}') task_name = to_remove.name session.delete(to_remove) session.commit()