From 3e96b9c1e9eaa76c408d0453fd1df77bdb96f9a0 Mon Sep 17 00:00:00 2001 From: Lars Date: Fri, 10 Jul 2026 06:31:41 +0200 Subject: [PATCH] Fix: Task-Roll-up mit RealDictCursor kompatibel. rollup_parent_status nutzte Index-Zugriff row[0]; pytest test_nested_tasks_and_rollup schlug fehl. Co-authored-by: Cursor --- backend/services/tasks.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/backend/services/tasks.py b/backend/services/tasks.py index f07e8bd..6d967e7 100644 --- a/backend/services/tasks.py +++ b/backend/services/tasks.py @@ -180,7 +180,9 @@ def _rollup_parent_status(cur, *, tenant_id: str, parent_task_id: str) -> None: """, (tenant_id, parent_task_id), ) - child_statuses = [row[0] for row in cur.fetchall()] + child_statuses = [ + row["status"] if isinstance(row, dict) else row[0] for row in cur.fetchall() + ] if not child_statuses: return if any(status not in TERMINAL_TASK_STATUSES for status in child_statuses): @@ -196,8 +198,11 @@ def _rollup_parent_status(cur, *, tenant_id: str, parent_task_id: str) -> None: (parent_task_id, tenant_id), ) row = cur.fetchone() - if row and row[0]: - _rollup_parent_status(cur, tenant_id=tenant_id, parent_task_id=str(row[0])) + if not row: + return + next_parent = row["parent_task_id"] if isinstance(row, dict) else row[0] + if next_parent: + _rollup_parent_status(cur, tenant_id=tenant_id, parent_task_id=str(next_parent)) def create_task(