From 523b9b31505b7fd6918b4de2753128e67216be00 Mon Sep 17 00:00:00 2001 From: king Date: Thu, 25 Jun 2026 16:59:57 +0900 Subject: [PATCH] =?UTF-8?q?fix(project):=20=ED=83=80=EC=9E=84=EB=9D=BC?= =?UTF-8?q?=EC=9D=B8=20=EB=B0=B0=EA=B2=BD=EC=9D=84=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=EC=A0=9D=ED=8A=B8=20=EC=8B=9C=EC=9E=91/=EB=A7=88=EA=B0=90?= =?UTF-8?q?=EC=9D=BC=20=EA=B8=B0=EC=A4=80=EC=9C=BC=EB=A1=9C=20=ED=91=9C?= =?UTF-8?q?=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 배경(전체 일정)을 업무 최소~최대가 아니라 프로젝트 자체 start_date~ due_date 로 칠한다. 업무가 그 밖에 있으면 범위를 넓혀 가리지 않게 유지. projects_meta 에 start_date/due_date 추가. Co-Authored-By: Claude Opus 4.8 --- app/modules/project/router.py | 2 ++ .../project/templates/project/index.html | 4 ++-- .../project/templates/project/project.html | 4 ++-- app/static/project.js | 19 +++++++++++++++---- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/app/modules/project/router.py b/app/modules/project/router.py index b372577..7440d18 100644 --- a/app/modules/project/router.py +++ b/app/modules/project/router.py @@ -399,6 +399,8 @@ async def project_page(request: Request, project_id: int) -> HTMLResponse: "id": p["id"], "name": p["name"], "color": p.get("color") or "#4573d2", + "start_date": p.get("start_date"), + "due_date": p.get("due_date"), }) nav_projects.append({ "id": p["id"], diff --git a/app/modules/project/templates/project/index.html b/app/modules/project/templates/project/index.html index 1c6c0f4..46e4944 100644 --- a/app/modules/project/templates/project/index.html +++ b/app/modules/project/templates/project/index.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -164,5 +164,5 @@ - + {% endblock %} diff --git a/app/modules/project/templates/project/project.html b/app/modules/project/templates/project/project.html index cc19d0a..a84db7c 100644 --- a/app/modules/project/templates/project/project.html +++ b/app/modules/project/templates/project/project.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + @@ -289,5 +289,5 @@ - + {% endblock %} diff --git a/app/static/project.js b/app/static/project.js index ca760be..df03ac7 100644 --- a/app/static/project.js +++ b/app/static/project.js @@ -441,6 +441,10 @@ const dated = tasks.filter(function (t) { return t.start_date || t.due_date; }); if (!dated.length) { node.innerHTML = '
기간이 설정된 업무가 없습니다.
'; return; } + // 프로젝트 메타(시작/마감/색) 조회용 + const projById = {}; + projectsMeta.forEach(function (p) { projById[p.id] = p; }); + // 프로젝트별로 업무를 묶어 그룹(행) 생성 const byProj = {}; dated.forEach(function (t) { (byProj[t.project_id] = byProj[t.project_id] || []).push(t); }); @@ -450,8 +454,9 @@ Object.keys(byProj).forEach(function (pid) { const list = byProj[pid]; const grp = "P" + pid; - const projColor = list[0].project_color || "#4573d2"; - groupRows.push({ id: grp, content: list[0].project_name || "프로젝트" }); + const meta = projById[pid] || {}; + const projColor = list[0].project_color || meta.color || "#4573d2"; + groupRows.push({ id: grp, content: list[0].project_name || meta.name || "프로젝트" }); let minMs = Infinity, maxMs = -Infinity; list.forEach(function (t) { const s = t.start_date || t.due_date; @@ -470,10 +475,16 @@ if (sm < minMs) minMs = sm; if (em > maxMs) maxMs = em; }); - maxMs += 86400000; // 마지막 날 하루를 덮도록 +1일 + // 배경(프로젝트 전체 일정) = 프로젝트 자체 시작/마감일 우선, 없으면 업무 최소~최대. + let bgStart = meta.start_date ? new Date(meta.start_date + "T00:00:00").getTime() : minMs; + let bgEnd = meta.due_date ? new Date(meta.due_date + "T00:00:00").getTime() : maxMs; + // 업무가 프로젝트 기간 밖에 있어도 가려지지 않게 범위를 넓힌다. + bgStart = Math.min(bgStart, minMs); + bgEnd = Math.max(bgEnd, maxMs); + bgEnd += 86400000; // 마지막 날 하루를 덮도록 +1일 items.push({ id: "bg" + pid, group: grp, type: "background", - start: new Date(minMs), end: new Date(maxMs), + start: new Date(bgStart), end: new Date(bgEnd), style: "background-color:" + projColor + "22;", }); });