feat(project): 목표 표 3열에서 줄 추가 = 같은 항목 칸(2열) 안에 — 항목 칸 묶음
- goal_rows.label_cont(마이그레이션 016): 바로 위 줄 항목 칸에 묶임, 이름은 묶음 첫 줄, 2열 rowspan(_goal_label_spans) - 3열 우클릭 위/아래에 줄 추가 → same_label: 같은 항목 칸 안(이름 묻지 않음), 첫 줄 위면 새 줄이 첫 줄로 이름 넘겨받음 - 2열 메뉴·+ 줄 추가는 묶음 밖(묶음 맨 위/맨 아래 기준), 묶인 2열 우클릭 → 항목 칸 나누기(split-label) - 묶음 첫 줄 삭제 → 다음 줄이 첫 줄·이름 넘겨받음, 묶인 줄 이동 400, 새 연도 복사에 묶음 유지 - 캐시 버전 20261001k, DB 회귀 test_goal_label_groups, 문서 갱신 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2516,6 +2516,7 @@ def inbox_page(request: Request) -> HTMLResponse:
|
||||
_GOALS_MIGRATION_MSG = "연간 목표 기능이 아직 준비되지 않았습니다(DB 마이그레이션 013 필요)."
|
||||
_GOALS_014_MSG = "상·하반기 칸과 칸 병합은 DB 마이그레이션 014 가 필요합니다."
|
||||
_GOALS_015_MSG = "세로 병합·연간/반기 칸 병합과 주간 회의록은 DB 마이그레이션 015 가 필요합니다."
|
||||
_GOALS_016_MSG = "같은 항목 칸 안에 줄 추가(3열)는 DB 마이그레이션 016 이 필요합니다."
|
||||
|
||||
|
||||
def _fmt_goal_num(v: float | None) -> str:
|
||||
@@ -2568,6 +2569,20 @@ def _goal_area_layout(rows: list[dict[str, Any]], this_month: int) -> None:
|
||||
row["layout"] = out
|
||||
|
||||
|
||||
def _goal_label_spans(rows: list[dict[str, Any]]) -> None:
|
||||
"""항목 칸(2열) 묶음(016) — 묶음 첫 줄 label_span = 이어 붙은 줄 수 + 1, 이어 붙은 줄은 label_span 0(2열을 그리지 않음).
|
||||
영역 첫 줄은 늘 묶음 첫 줄."""
|
||||
for k, row in enumerate(rows):
|
||||
if k == 0 or not row.get("label_cont"):
|
||||
row["label_cont"] = False
|
||||
n = 1
|
||||
while k + n < len(rows) and rows[k + n].get("label_cont"):
|
||||
n += 1
|
||||
row["label_span"] = n
|
||||
else:
|
||||
row["label_span"] = 0
|
||||
|
||||
|
||||
def _goal_call(fn: Any, *args: Any, **kwargs: Any) -> Any:
|
||||
"""목표 DB 호출 공통 — 013 미적용 503, 없는 대상 404, 입력 오류 400."""
|
||||
try:
|
||||
@@ -2576,6 +2591,8 @@ def _goal_call(fn: Any, *args: Any, **kwargs: Any) -> Any:
|
||||
raise HTTPException(status_code=503, detail=_GOALS_014_MSG)
|
||||
except store.GoalMigration015Needed:
|
||||
raise HTTPException(status_code=503, detail=_GOALS_015_MSG)
|
||||
except store.GoalMigration016Needed:
|
||||
raise HTTPException(status_code=503, detail=_GOALS_016_MSG)
|
||||
except UndefinedTable:
|
||||
raise HTTPException(status_code=503, detail=_GOALS_MIGRATION_MSG)
|
||||
except KeyError:
|
||||
@@ -2617,6 +2634,7 @@ def goals_page(request: Request, year: int) -> HTMLResponse:
|
||||
m[kind + "_label"] = {mo: _goal_label(metric, v) for mo, v in m[kind].items()}
|
||||
for area in board["areas"]:
|
||||
_goal_area_layout(area["rows"], this_month)
|
||||
_goal_label_spans(area["rows"])
|
||||
return render_template(
|
||||
request,
|
||||
"project/goals.html",
|
||||
@@ -2730,7 +2748,8 @@ def api_add_goal_row(request: Request, area_id: int, payload: dict[str, Any] = B
|
||||
except (TypeError, ValueError):
|
||||
raise HTTPException(status_code=400, detail="ref_row_id 가 올바르지 않습니다.")
|
||||
rid = _goal_call(st.add_goal_row, area_id=area_id, label=payload.get("label", ""),
|
||||
ref_row_id=ref_id, place=payload.get("place") or "below")
|
||||
ref_row_id=ref_id, place=payload.get("place") or "below",
|
||||
same_label=bool(payload.get("same_label")))
|
||||
return JSONResponse({"ok": True, "id": rid}, status_code=201)
|
||||
|
||||
|
||||
@@ -2750,6 +2769,15 @@ def api_delete_goal_row(request: Request, row_id: int) -> JSONResponse:
|
||||
return JSONResponse({"ok": True})
|
||||
|
||||
|
||||
@router.post("/api/goals/rows/{row_id}/split-label")
|
||||
def api_split_goal_label(request: Request, row_id: int) -> JSONResponse:
|
||||
"""항목 칸 나누기 — 묶음 첫 줄 아래 이어 붙은 줄들을 각자 항목 칸으로(016)."""
|
||||
_require_admin(request)
|
||||
st = _db_or_503(request)
|
||||
n = _goal_call(st.split_goal_label, row_id=row_id)
|
||||
return JSONResponse({"ok": True, "split": n})
|
||||
|
||||
|
||||
@router.post("/api/goals/rows/{row_id}/move")
|
||||
def api_move_goal_row(request: Request, row_id: int, payload: dict[str, Any] = Body(...)) -> JSONResponse:
|
||||
_require_admin(request)
|
||||
|
||||
Reference in New Issue
Block a user