diff --git a/app/routers/todos.py b/app/routers/todos.py index 90c6062..0822a09 100644 --- a/app/routers/todos.py +++ b/app/routers/todos.py @@ -4,6 +4,12 @@ from app.vikunja import create_task, delete_task, get_tasks, update_task router = APIRouter(prefix="/todos", tags=["todos"]) +@router.get("/count") +def count_todos(): + tasks = get_tasks() + return {"open": sum(1 for t in tasks if not t.get("done"))} + + @router.get("/") def list_todos(): return get_tasks() diff --git a/app/templates/base.html b/app/templates/base.html index 89eca37..82e6273 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -60,7 +60,7 @@