Fix empty goal groups not appearing in the Goals tab.
Include goal groups without items in the structured goals API so newly created groups show up immediately. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -499,6 +499,20 @@ def list_goals_structured(db_path: Path | str = DEFAULT_DB) -> dict[str, Any]:
|
|||||||
if goal["completed_at"]:
|
if goal["completed_at"]:
|
||||||
groups_map[gid]["completed"] += 1
|
groups_map[gid]["completed"] += 1
|
||||||
|
|
||||||
|
empty_groups = conn.execute(
|
||||||
|
"SELECT id, name FROM goal_groups ORDER BY created_at ASC, id ASC"
|
||||||
|
).fetchall()
|
||||||
|
for row in empty_groups:
|
||||||
|
gid = row["id"]
|
||||||
|
if gid not in groups_map:
|
||||||
|
groups_map[gid] = {
|
||||||
|
"id": gid,
|
||||||
|
"name": row["name"],
|
||||||
|
"total": 0,
|
||||||
|
"completed": 0,
|
||||||
|
"goals": [],
|
||||||
|
}
|
||||||
|
|
||||||
conn.close()
|
conn.close()
|
||||||
return {
|
return {
|
||||||
"groups": list(groups_map.values()),
|
"groups": list(groups_map.values()),
|
||||||
|
|||||||
Reference in New Issue
Block a user