fix: create_task 的 iteration_id 归一化为迭代名(agent 传迭代 ID 时反查名称),修复任务树按名匹配计数为 0 的矛盾
This commit is contained in:
parent
8c6e49992c
commit
ac85ee67f1
@ -368,8 +368,16 @@ async def _h_create_task(sor, p, ctx):
|
||||
tid = getID()
|
||||
# 迭代归属:显式指定 > 当前迭代(该 project 最新创建的迭代)。
|
||||
# 「当前迭代」概念:新建迭代后当前迭代即新建的那个,任务默认归到它。
|
||||
# 统一存「迭代名」:agent 可能传迭代 ID 或迭代名,都归一化为迭代名(task_tree 按名匹配)。
|
||||
iteration_name = (p.get("iteration_id", "") or "").strip()
|
||||
if not iteration_name:
|
||||
if iteration_name:
|
||||
# 归一化:传的是迭代 ID → 反查迭代名;传的是迭代名 → 反查不到则保持原名
|
||||
irecs = await sor.sqlExe(
|
||||
"SELECT iteration_name FROM sd_iterations WHERE id=${iid}$ AND project_id=${pid}$",
|
||||
{"iid": iteration_name, "pid": pid})
|
||||
if irecs and getattr(irecs[0], 'iteration_name', ''):
|
||||
iteration_name = getattr(irecs[0], 'iteration_name', '')
|
||||
else:
|
||||
irecs = await sor.sqlExe(
|
||||
"SELECT iteration_name FROM sd_iterations WHERE project_id=${pid}$ ORDER BY created_at DESC LIMIT 1",
|
||||
{"pid": pid})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user