fix: list tasks via project endpoint, filter undone+labelled
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Zoë 2026-05-30 17:35:01 -07:00
parent 06c576b024
commit 69d40646be

View file

@ -89,7 +89,7 @@ def list_todo_tasks(vikunja_token: str) -> list[dict]:
page = 1 page = 1
while True: while True:
resp = httpx.get( resp = httpx.get(
f"{VIKUNJA_BASE_URL}/api/v1/projects/{VIKUNJA_PROJECT_ID}/views/{VIKUNJA_KANBAN_VIEW_ID}/buckets/{VIKUNJA_TODO_BUCKET_ID}/tasks", f"{VIKUNJA_BASE_URL}/api/v1/projects/{VIKUNJA_PROJECT_ID}/tasks",
headers={"Authorization": f"Bearer {vikunja_token}"}, headers={"Authorization": f"Bearer {vikunja_token}"},
params={"page": page, "per_page": 50}, params={"page": page, "per_page": 50},
timeout=15, timeout=15,
@ -102,7 +102,10 @@ def list_todo_tasks(vikunja_token: str) -> list[dict]:
if len(batch) < 50: if len(batch) < 50:
break break
page += 1 page += 1
return tasks # Tasks in Todo bucket have done=False and agent label.
# Since done tasks are marked done=True, filtering undone tasks
# with an agent label is sufficient.
return [t for t in tasks if not t.get("done") and t.get("labels")]
def extract_agent_role(task: dict) -> str | None: def extract_agent_role(task: dict) -> str | None: