feat(project): dashboard workload by assignee with subtasks and completion

Replace the scheduled-tasks bar chart with a table of all tasks assigned
per person in scope (no due date needed, filters ignored): main tasks,
subtasks (new GET /api/projects/{id}/subtasks-summary), done counts and
completion rate, plus a total row. Admin only, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 14:09:06 +09:00
parent c766af691a
commit fc3a2d0b9b
14 changed files with 247 additions and 26 deletions
+18
View File
@@ -1335,6 +1335,24 @@ def api_project_snapshot(request: Request, project_id: int, scope: str = "projec
})
@router.get("/api/projects/{project_id}/subtasks-summary")
def api_subtasks_summary(request: Request, project_id: int, scope: str = "project") -> JSONResponse:
"""대시보드 "담당자별 작업 합계" — 화면 업무 목록엔 하위 업무가 없어서(보드에 카드로 안 뜨게) 하위 업무만 따로.
scope=project → 이 프로젝트(+여기 연결된) 최상위 업무의 하위 업무, scope=all → 볼 수 있는 모든 최상위 프로젝트(스냅샷과 같은 범위)."""
user = _require_user(request)
st = _db_or_503(request)
_require_manage(request, st, user, project_id)
if scope == "all":
allowed = _accessible_project_ids(st, user)
ids = [p["id"] for p in st.list_projects(include_archived=False,
member_email=None if allowed is None else user["email"])
if not p.get("parent_id")]
else:
ids = [project_id]
parents = [t["id"] for t in st.list_tasks_for_projects(project_ids=ids)]
return JSONResponse({"subtasks": st.list_subtasks_of(parent_ids=parents)})
def _project_meta(p: dict[str, Any]) -> dict[str, Any]:
"""프로젝트 화면·스냅샷 공용 프로젝트 요약(사이드바·타임라인 그룹·보드 배지용)."""
return {