Skip to content

Commit

Permalink
fix: missing delete_task function in db
Browse files Browse the repository at this point in the history
  • Loading branch information
cachebag committed Feb 8, 2025
1 parent dfae500 commit f3c863b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,8 @@ skip-magic-trailing-comma = false
[tool.black]
line-length = 88
target-version = ['py38']
include = '\.pyi?$'
include = '\.pyi?$'

[tool.pytest.ini_options]
asyncio_mode = "strict"
asyncio_default_fixture_loop_scope = "function"
15 changes: 15 additions & 0 deletions ticked/core/database/ticked_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,21 @@ def update_task(self, task_id: int, **kwargs) -> bool:
conn.commit()
return cursor.rowcount > 0

def delete_task(self, task_id: int) -> bool:
"""Delete a task by its ID.
Args:
task_id (int): The ID of the task to delete
Returns:
bool: True if task was deleted, False if task was not found
"""
with sqlite3.connect(self.db_path) as conn:
cursor = conn.cursor()
cursor.execute("DELETE FROM tasks WHERE id = ?", (task_id,))
conn.commit()
return cursor.rowcount > 0

def delete_tasks_not_in_uids(self, uids: set[str]) -> None:
if not uids:
return
Expand Down

0 comments on commit f3c863b

Please sign in to comment.