fix(task_tree): 阶段计数排除子任务,与阶段平铺口径一致

- 阶段列表 role_cnt 之前统计所有该role任务(含子任务),但阶段平铺只列 parent_id 为空的顶层任务
- 导致有子任务的角色(如 develop 挂在 design 名下)计数>0 但点开为空,前端显示'任务不存在'
- 修复:role_cnt 跳过有 parent_id 的子任务,与平铺逻辑(if parent: continue)口径一致
This commit is contained in:
ymq 2026-08-20 15:43:16 +08:00
parent 482c2c2f22
commit 60b3870278

View File

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