feat(project): subtask rows and a wide view for the meeting task table
- Subtask rows (one level, parent_id): hover button / right-click to add, Tab to make a row the subtask of the row above, Shift+Tab to move it back; inherits the parent's project, no section - Apply on a subtask row creates the task under the parent row's task (server-checked) - "크게 열기" moves the same table into a wide window (same rows and saves), Esc/x to close - Server: PUT parent_id with one-level rules; add rejects grandchildren - Help + docs; tests (real PostgreSQL rules + parent apply, jsdom rows/Tab/wide view) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3443,9 +3443,12 @@ class ProjectStore:
|
||||
self._check_meeting_open(conn, week_start)
|
||||
clean = self._mt_clean(conn, fields)
|
||||
if parent_id is not None:
|
||||
par = conn.execute("SELECT week_start FROM goal_meeting_tasks WHERE id = %s", (parent_id,)).fetchone()
|
||||
par = conn.execute("SELECT week_start, parent_id FROM goal_meeting_tasks WHERE id = %s",
|
||||
(parent_id,)).fetchone()
|
||||
if par is None or par["week_start"] != week_start:
|
||||
raise ValueError("위 줄이 이 주차 표에 없습니다.")
|
||||
if par["parent_id"] is not None:
|
||||
raise ValueError("세부 작업 줄 밑으로는 넣을 수 없습니다(한 단계만).")
|
||||
nxt = conn.execute("SELECT COALESCE(MAX(sort_order), -1) + 1 AS n FROM goal_meeting_tasks "
|
||||
"WHERE week_start = %s", (week_start,)).fetchone()["n"]
|
||||
return int(conn.execute(
|
||||
@@ -3470,6 +3473,25 @@ class ProjectStore:
|
||||
if row["task_id"] is not None:
|
||||
raise store.GoalCellConflict("이미 [적용]해 작업으로 만든 줄입니다. 새로고침해 주세요.")
|
||||
clean = self._mt_clean(conn, fields, project_id=row["project_id"])
|
||||
if "parent_id" in fields:
|
||||
# 세부 작업 줄로(Tab)·위 단계로(Shift+Tab) — 한 단계만: 위 줄은 같은 주차의 맨 위 단계 줄,
|
||||
# 자기 밑에 세부 작업 줄이 있는 줄은 세부 작업 줄이 될 수 없다.
|
||||
raw = fields.get("parent_id")
|
||||
try:
|
||||
pid = int(raw) if raw not in (None, "") else None
|
||||
except (TypeError, ValueError):
|
||||
raise ValueError("위 줄 값이 올바르지 않습니다.")
|
||||
if pid is not None:
|
||||
par = conn.execute("SELECT week_start, parent_id FROM goal_meeting_tasks WHERE id = %s",
|
||||
(pid,)).fetchone()
|
||||
if pid == item_id or par is None or par["week_start"] != row["week_start"]:
|
||||
raise ValueError("위 줄이 이 주차 표에 없습니다.")
|
||||
if par["parent_id"] is not None:
|
||||
raise ValueError("세부 작업 줄 밑으로는 넣을 수 없습니다(한 단계만).")
|
||||
if conn.execute("SELECT 1 FROM goal_meeting_tasks WHERE parent_id = %s LIMIT 1",
|
||||
(item_id,)).fetchone():
|
||||
raise ValueError("세부 작업 줄이 딸린 줄은 세부 작업이 될 수 없습니다.")
|
||||
clean["parent_id"] = pid
|
||||
if not clean:
|
||||
return
|
||||
sets = ", ".join(f"{k} = %s" for k in clean)
|
||||
@@ -3506,12 +3528,16 @@ class ProjectStore:
|
||||
if row["task_id"] is not None:
|
||||
return item_id, False
|
||||
parent_task = None
|
||||
use = self._mt_row(row)
|
||||
if row["parent_id"] is not None:
|
||||
par = conn.execute("SELECT task_id FROM goal_meeting_tasks WHERE id = %s", (row["parent_id"],)).fetchone()
|
||||
# 세부 작업 줄 — 위 줄이 만든 작업 밑에, 그 작업의 프로젝트로(줄의 프로젝트 칸은 쓰지 않는다)
|
||||
par = conn.execute("SELECT m.task_id, t.project_id FROM goal_meeting_tasks m "
|
||||
"LEFT JOIN tasks t ON t.id = m.task_id WHERE m.id = %s", (row["parent_id"],)).fetchone()
|
||||
parent_task = par["task_id"] if par else None
|
||||
if parent_task is None:
|
||||
if parent_task is None or par["project_id"] is None:
|
||||
raise ValueError("위 줄(상위 작업)을 먼저 [적용]하세요.")
|
||||
task = create(self._mt_row(row), parent_task)
|
||||
use = {**use, "project_id": int(par["project_id"]), "stage_id": None}
|
||||
task = create(use, parent_task)
|
||||
conn.execute("UPDATE goal_meeting_tasks SET task_id = %s, updated_at = now() WHERE id = %s",
|
||||
(int(task["id"]), item_id))
|
||||
return item_id, True
|
||||
|
||||
Reference in New Issue
Block a user