diff --git a/src/api/project_routes.py b/src/api/project_routes.py index 37e517b..6c73cff 100644 --- a/src/api/project_routes.py +++ b/src/api/project_routes.py @@ -31,9 +31,13 @@ async def list_projects(): if db_path.exists(): try: conn = sqlite3.connect(str(db_path), timeout=5) - count = conn.execute("SELECT COUNT(*) FROM tasks").fetchone()[0] + total = conn.execute("SELECT COUNT(*) FROM tasks WHERE status != 'cancelled'").fetchone()[0] + active = conn.execute("SELECT COUNT(*) FROM tasks WHERE status NOT IN ('cancelled','done') AND COALESCE(archived,0)=0").fetchone()[0] + archived = total - active conn.close() - info['task_count'] = count + info['task_count'] = active + info['task_count_total'] = total + info['task_count_archived'] = archived except Exception: pass # 虚拟项目 _general:如果 blackboard.db 存在则插入