fix: use bucket-specific endpoint to list Todo tasks
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
/projects/{id}/tasks returns bucket_id=0 for all tasks.
Use /projects/{p}/views/{v}/buckets/{b}/tasks instead.
This commit is contained in:
parent
33e360cd30
commit
06c576b024
1 changed files with 3 additions and 3 deletions
|
|
@ -40,6 +40,7 @@ VIKUNJA_BASE_URL = os.environ.get("VIKUNJA_BASE_URL", "https://tasks.ctz.fyi")
|
|||
VIKUNJA_PROJECT_ID = int(os.environ.get("VIKUNJA_PROJECT_ID", "78"))
|
||||
VIKUNJA_TODO_BUCKET_ID = int(os.environ.get("VIKUNJA_TODO_BUCKET_ID", "116"))
|
||||
VIKUNJA_IN_PROGRESS_BUCKET_ID = int(os.environ.get("VIKUNJA_IN_PROGRESS_BUCKET_ID", "117"))
|
||||
VIKUNJA_KANBAN_VIEW_ID = int(os.environ.get("VIKUNJA_KANBAN_VIEW_ID", "114"))
|
||||
|
||||
K8S_NAMESPACE = os.environ.get("K8S_NAMESPACE", "autojanet")
|
||||
AGENT_IMAGE = os.environ.get("AGENT_IMAGE", "registry.ctz.fyi/library/autojanet-agent:latest")
|
||||
|
|
@ -88,7 +89,7 @@ def list_todo_tasks(vikunja_token: str) -> list[dict]:
|
|||
page = 1
|
||||
while True:
|
||||
resp = httpx.get(
|
||||
f"{VIKUNJA_BASE_URL}/api/v1/projects/{VIKUNJA_PROJECT_ID}/tasks",
|
||||
f"{VIKUNJA_BASE_URL}/api/v1/projects/{VIKUNJA_PROJECT_ID}/views/{VIKUNJA_KANBAN_VIEW_ID}/buckets/{VIKUNJA_TODO_BUCKET_ID}/tasks",
|
||||
headers={"Authorization": f"Bearer {vikunja_token}"},
|
||||
params={"page": page, "per_page": 50},
|
||||
timeout=15,
|
||||
|
|
@ -101,8 +102,7 @@ def list_todo_tasks(vikunja_token: str) -> list[dict]:
|
|||
if len(batch) < 50:
|
||||
break
|
||||
page += 1
|
||||
# Filter to Todo bucket only
|
||||
return [t for t in tasks if t.get("bucket_id") == VIKUNJA_TODO_BUCKET_ID]
|
||||
return tasks
|
||||
|
||||
|
||||
def extract_agent_role(task: dict) -> str | None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue