From 60b3870278f5dc1f4699b7e4395d8796bd683b06 Mon Sep 17 00:00:00 2001 From: ymq Date: Thu, 20 Aug 2026 15:43:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(task=5Ftree):=20=E9=98=B6=E6=AE=B5=E8=AE=A1?= =?UTF-8?q?=E6=95=B0=E6=8E=92=E9=99=A4=E5=AD=90=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E4=B8=8E=E9=98=B6=E6=AE=B5=E5=B9=B3=E9=93=BA=E5=8F=A3=E5=BE=84?= =?UTF-8?q?=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 阶段列表 role_cnt 之前统计所有该role任务(含子任务),但阶段平铺只列 parent_id 为空的顶层任务 - 导致有子任务的角色(如 develop 挂在 design 名下)计数>0 但点开为空,前端显示'任务不存在' - 修复:role_cnt 跳过有 parent_id 的子任务,与平铺逻辑(if parent: continue)口径一致 --- wwwroot/api/task_tree.dspy | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wwwroot/api/task_tree.dspy b/wwwroot/api/task_tree.dspy index c5c421e..9caa3e8 100644 --- a/wwwroot/api/task_tree.dspy +++ b/wwwroot/api/task_tree.dspy @@ -144,6 +144,10 @@ async with DBPools().sqlorContext(dbname) as sor: # 阶段列表 role_cnt = {} for t in iter_tasks: + # 子任务(有 parent_id)挂在父任务下展示,不计入阶段计数, + # 否则阶段节点计数与点开后的平铺任务数不一致(计数含子任务、平铺只列顶层任务)。 + if (getattr(t, 'parent_id', '') or '').strip(): + continue r = (getattr(t, 'role', '') or '').strip() role_cnt[r] = role_cnt.get(r, 0) + 1 nodes = []