fix: handle missing answered column in questions table
This commit is contained in:
parent
3b1b6c8e43
commit
fff7bace28
@ -643,15 +643,20 @@ class AgentExecutor:
|
|||||||
review = await sor.sqlExe(
|
review = await sor.sqlExe(
|
||||||
"SELECT COUNT(*) as c FROM pipeline_tasks WHERE tenant_id=${pid}$ AND state='review'",
|
"SELECT COUNT(*) as c FROM pipeline_tasks WHERE tenant_id=${pid}$ AND state='review'",
|
||||||
{"pid": pid})
|
{"pid": pid})
|
||||||
questions = await sor.sqlExe(
|
# questions 表可能没有 answered 列,用 try/except 兜底
|
||||||
"SELECT COUNT(*) as c FROM pipeline_agent_questions WHERE tenant_id=${pid}$ AND answered IS NULL",
|
qc = 0
|
||||||
{"pid": pid})
|
try:
|
||||||
|
questions = await sor.sqlExe(
|
||||||
|
"SELECT COUNT(*) as c FROM pipeline_agent_questions WHERE tenant_id=${pid}$ AND answered IS NULL",
|
||||||
|
{"pid": pid})
|
||||||
|
qc = getattr(questions[0], "c", 0) if questions else 0
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
sc = getattr(submitted[0], "c", 0) if submitted else 0
|
sc = getattr(submitted[0], "c", 0) if submitted else 0
|
||||||
rc = getattr(running[0], "c", 0) if running else 0
|
rc = getattr(running[0], "c", 0) if running else 0
|
||||||
fc = getattr(failed[0], "c", 0) if failed else 0
|
fc = getattr(failed[0], "c", 0) if failed else 0
|
||||||
vc = getattr(review[0], "c", 0) if review else 0
|
vc = getattr(review[0], "c", 0) if review else 0
|
||||||
qc = getattr(questions[0], "c", 0) if questions else 0
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
f"项目诊断:\n"
|
f"项目诊断:\n"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user