auto-sync: 2026-05-21 00:12:16

This commit is contained in:
cfdaily
2026-05-21 00:12:16 +08:00
parent b11f38f2a0
commit 7918763fb8
+13
View File
@@ -21,6 +21,19 @@ def _registry() -> ProjectRegistry:
async def list_projects():
reg = _registry()
projects = reg.list_projects()
# 实时统计每个项目的任务数
from src.blackboard.db import Blackboard
from pathlib import Path
for pid, info in projects.items():
if info.get("status") in ("archived", "deleted"):
continue
db_path = Path(reg.root) / pid / "blackboard.db"
if db_path.exists():
try:
bb = Blackboard(db_path)
info['task_count'] = bb.count_tasks()
except Exception:
pass
return {"projects": {pid: info for pid, info in projects.items()
if info.get("status") not in ("archived", "deleted")}}