feat(project): workload chart counts nested subtasks

subtasks-summary now returns every level under the scope's main tasks
(recursive CTE, depth <= 20) with root_task_id and parent_title; the
dashboard groups by root_task_id. Also fix drawer header '세부 작업 작업'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 16:57:36 +09:00
parent 6a1c437635
commit ee9c04147a
4 changed files with 30 additions and 12 deletions
+5 -4
View File
@@ -5846,7 +5846,7 @@
root.appendChild(charts);
}
// ── 담당자별 작업 합계 — 메인(이 범위 최상위 작업, 중복 없이) + 하위(서버 subtasks-summary), 완료 수 ──
// ── 담당자별 작업 합계 — 메인(이 범위 최상위 작업, 중복 없이) + 세부(서버 subtasks-summary — 모든 단계), 완료 수 ──
let workloadCache = { scope: "", at: 0, subtasks: null, pending: null };
function loadWorkloadSubtasks(force) {
const fresh = workloadCache.scope === viewScope && Date.now() - workloadCache.at < 15000;
@@ -5885,7 +5885,7 @@
d.innerHTML = '<div class="pj-wl-drawer-dim"></div><aside class="pj-wl-panel" role="dialog" aria-label="업무 목록">' +
'<header><div><b></b><small></small></div><button type="button" class="pj-icon-btn" data-act="close" title="닫기">' +
'<span class="material-symbols-outlined">close</span></button></header><div class="pj-wl-panel-body"></div></aside>';
d.querySelector("header b").textContent = person + " · " + kind + " 작업";
d.querySelector("header b").textContent = person + " · " + kind; // kind = "메인 작업"·"세부 작업"
d.querySelector("header small").textContent = "완료 " + done.length + " / " + items.length + (items.length ? " (" + Math.round(done.length / items.length * 100) + "%)" : "");
const body = d.querySelector(".pj-wl-panel-body");
const sortKey = function (t) { return (t.due_date || "9999") + (t.title || ""); };
@@ -5902,7 +5902,7 @@
btn.innerHTML = '<span class="material-symbols-outlined">' + ((t.completed_at || t.done) ? "check_circle" : "radio_button_unchecked") + "</span>" +
'<span class="pj-wl-item-main"><span class="pj-wl-item-title"></span><small></small></span><em></em>';
btn.querySelector(".pj-wl-item-title").textContent = t.title || "(제목 없음)";
const parent = isSub && seenTask(t.parent_task_id);
const parent = isSub && (seenTask(t.parent_task_id) || (t.parent_title ? { title: t.parent_title } : null));
btn.querySelector("small").textContent = parent ? "상위: " + (parent.title || "") : (t.stage_name || "");
btn.querySelector("em").textContent = t.due_date ? fmtShortDate(t.due_date) : "";
btn.addEventListener("click", function () { openTaskById(t.id); });
@@ -5968,7 +5968,8 @@
function draw(subs) {
Object.keys(rows).forEach(function (k) { rows[k].subs = []; });
(subs || []).forEach(function (st) {
if (!seen[st.parent_task_id]) return; // 이 범위의 메인 작업에 딸린 세부 작업만
// 이 범위의 메인 작업에 딸린 세부 작업만 — 세부 작업의 세부 작업까지(root_task_id = 맨 위 메인 작업, 2026-10-08)
if (!seen[st.root_task_id || st.parent_task_id]) return;
row(st.assignee_email, st.assignee_name).subs.push(st);
});
const doneOf = function (list) { return list.filter(function (t) { return t.completed_at || t.done; }).length; };