auto-sync: 2026-05-21 08:27:50

This commit is contained in:
cfdaily
2026-05-21 08:27:50 +08:00
parent 0e2d349f31
commit c56bc577fa
+9 -4
View File
@@ -45,11 +45,13 @@ async def list_projects():
if general_db.exists() and "_general" not in projects:
try:
conn = sqlite3.connect(str(general_db), 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]
conn.close()
projects["_general"] = {
"id": "_general", "name": "一般任务", "description": "无项目归属的通用任务",
"status": "active", "source": "virtual", "task_count": count,
"status": "active", "source": "virtual",
"task_count": active, "task_count_total": total, "task_count_archived": total - active,
}
except Exception:
pass
@@ -58,9 +60,12 @@ async def list_projects():
if general_db_check.exists():
try:
conn = sqlite3.connect(str(general_db_check), 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]
conn.close()
projects["_general"]["task_count"] = count
projects["_general"]["task_count"] = active
projects["_general"]["task_count_total"] = total
projects["_general"]["task_count_archived"] = total - active
except Exception:
pass
return {"projects": {pid: info for pid, info in projects.items()