Add per-workstream task counts to state summary and dashboard

API:
- WorkstreamWithTaskCounts schema extends WorkstreamRead with
  tasks_total/todo/in_progress/blocked/done fields
- /state/summary now includes these counts in open_workstreams via
  a single extra GROUP BY query (workstream_id, status)

Dashboard:
- Replace domain workstream-count bar with a horizontal stacked
  progress bar per workstream (done/in-progress/blocked/todo)
- Workstreams with no tasks show "no tasks yet" annotation
- Workstreams with tasks show "X/N done" label after the bar
- Sorted by domain then title so domains group naturally

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-25 00:50:43 +01:00
parent 379a3b1a01
commit cabeefe070
4 changed files with 77 additions and 18 deletions

View File

@@ -6,7 +6,7 @@ from api.schemas.decision import DecisionRead
from api.schemas.progress_event import ProgressEventRead
from api.schemas.task import TaskRead
from api.schemas.topic import TopicWithWorkstreams
from api.schemas.workstream import WorkstreamRead
from api.schemas.workstream import WorkstreamWithTaskCounts
class TopicTotals(BaseModel):
@@ -55,4 +55,4 @@ class StateSummary(BaseModel):
blocking_decisions: list[DecisionRead]
blocked_tasks: list[TaskRead]
recent_progress: list[ProgressEventRead]
open_workstreams: list[WorkstreamRead]
open_workstreams: list[WorkstreamWithTaskCounts]

View File

@@ -36,3 +36,11 @@ class WorkstreamRead(BaseModel):
due_date: date | None = None
created_at: datetime
updated_at: datetime
class WorkstreamWithTaskCounts(WorkstreamRead):
tasks_total: int = 0
tasks_todo: int = 0
tasks_in_progress: int = 0
tasks_blocked: int = 0
tasks_done: int = 0