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 = []