feat(project): meeting rows added from the task cell stay in the same item cell (migration 027), in-place redraw with animation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1196,6 +1196,78 @@ def test_review_meeting_section_move():
|
||||
_drop_meetings([w1, w2])
|
||||
|
||||
|
||||
def test_review_meeting_label_groups():
|
||||
"""항목 칸 묶음(027) — 주요 업무 칸에서 추가(same_label)는 같은 항목 칸 안에(아래 = 이어 붙음, 묶음 첫 줄 위 = 새 줄이
|
||||
첫 줄·이름 넘겨받음), 화면은 항목 칸 rowspan, 묶인 줄은 순서 이동 거절, 다음 주 회의록이 묶음을 이어받음,
|
||||
첫 줄 삭제 = 아래 줄이 이름을 이어받음, 항목 칸 나누기, 회의 완료 뒤 잠금."""
|
||||
from app.modules.project import store
|
||||
|
||||
w1 = store.month_weeks(2032, 2)[1][0]
|
||||
w2 = store.week_period(w1)[1] + timedelta(days=1)
|
||||
_drop_meetings([w1, w2])
|
||||
try:
|
||||
_create_meeting(w1)
|
||||
rows = lambda w=w1: ST.get_meeting(week_start=w)["items"] # noqa: E731
|
||||
a = rows()[0]
|
||||
url = f"/project/api/goals/meetings/{w1}/items"
|
||||
r = req("POST", url, BOB, json={"section": a["section"], "ref_item_id": a["id"], "place": "below", "same_label": True})
|
||||
assert r.status_code == 201, r.text
|
||||
b_id = r.json()["id"]
|
||||
cur = rows()
|
||||
k = [x["id"] for x in cur].index(a["id"])
|
||||
assert cur[k + 1]["id"] == b_id and cur[k + 1]["label_cont"] and cur[k + 1]["label"] == "" and not cur[k]["label_cont"]
|
||||
# 묶음 첫 줄 위 → 새 줄이 첫 줄(이름 넘겨받음), 기준 줄은 이어 붙음
|
||||
r = req("POST", url, BOB, json={"section": a["section"], "ref_item_id": a["id"], "place": "above", "same_label": True})
|
||||
assert r.status_code == 201, r.text
|
||||
c_id = r.json()["id"]
|
||||
cur = rows()
|
||||
ids = [x["id"] for x in cur]
|
||||
k = ids.index(c_id)
|
||||
assert ids[k:k + 3] == [c_id, a["id"], b_id], ids
|
||||
assert cur[k]["label"] == a["label"] and not cur[k]["label_cont"]
|
||||
assert cur[k + 1]["label"] == "" and cur[k + 1]["label_cont"] and cur[k + 2]["label_cont"]
|
||||
# 줄마다 연결키는 따로(지난주 리뷰가 줄 단위로 이어짐)
|
||||
assert len({cur[k + n]["line_key"] for n in range(3)}) == 3
|
||||
# 화면 — 회의록 화면이 그려지고(이 테스트 환경은 템플릿을 실제로 그리지 않음 — 표 모양은 jsdom [2h]),
|
||||
# 화면용 묶음 계산(라우터 도우미) = 항목 칸 rowspan 3 · 이어 붙은 줄은 항목 칸 없음
|
||||
from app.modules.project.router import _meeting_label_spans
|
||||
page = req("GET", f"/project/goals/{w1.year}/meetings/{w1.month}?week={w1}&content=1", BOB)
|
||||
assert page.status_code == 200, page.text[:300]
|
||||
sec_rows = [x for x in rows() if x["section"] == a["section"]]
|
||||
_meeting_label_spans(sec_rows)
|
||||
spans = {x["id"]: (x.get("label_span"), x["label_hidden"], x["label_shown"]) for x in sec_rows}
|
||||
assert spans[c_id][:2] == (3, False) and spans[a["id"]][1] and spans[b_id][1], spans
|
||||
assert spans[b_id][2] == a["label"]
|
||||
# 묶인 줄은 옮길 수 없다(항목 칸을 나눈 뒤)
|
||||
r = req("POST", f"/project/api/goals/meeting-items/{a['id']}/move", BOB, json={"direction": 1})
|
||||
assert r.status_code == 400 and "항목 칸" in r.text, r.text
|
||||
# 같은 항목 칸 추가는 기준 줄이 필요
|
||||
assert req("POST", url, BOB, json={"section": a["section"], "same_label": True}).status_code == 400
|
||||
# 다음 주 회의록 — 묶음을 그대로 이어받음(연결키 기준)
|
||||
_create_meeting(w2)
|
||||
by_key = {x["line_key"]: x for x in rows(w2)}
|
||||
assert [bool(by_key[cur[k + n]["line_key"]]["label_cont"]) for n in range(3)] == [False, True, True]
|
||||
assert by_key[cur[k]["line_key"]]["label"] == a["label"]
|
||||
# 첫 줄(c) 삭제 → 바로 아래 줄(a)이 첫 줄이 되고 이름을 이어받음
|
||||
assert req("DELETE", f"/project/api/goals/meeting-items/{c_id}", BOB).status_code == 200
|
||||
cur = rows()
|
||||
k = [x["id"] for x in cur].index(a["id"])
|
||||
assert not cur[k]["label_cont"] and cur[k]["label"] == a["label"] and cur[k + 1]["id"] == b_id and cur[k + 1]["label_cont"]
|
||||
# 항목 칸 나누기 → b 가 따로(이름 빈 칸)
|
||||
r = req("POST", f"/project/api/goals/meeting-items/{a['id']}/split-label", BOB)
|
||||
assert r.status_code == 200 and r.json()["split"] == 1, r.text
|
||||
cur = rows()
|
||||
k = [x["id"] for x in cur].index(b_id)
|
||||
assert not cur[k]["label_cont"] and cur[k]["label"] == ""
|
||||
assert req("POST", f"/project/api/goals/meeting-items/{a['id']}/move", BOB, json={"direction": 1}).status_code == 200
|
||||
# 회의 완료 뒤 잠금
|
||||
ST.set_meeting_completed(week_start=w1, done=True, by=ADMIN)
|
||||
assert req("POST", url, BOB, json={"section": a["section"], "ref_item_id": a["id"], "place": "below",
|
||||
"same_label": True}).status_code == 409
|
||||
finally:
|
||||
_drop_meetings([w1, w2])
|
||||
|
||||
|
||||
def _clear_quick(*weeks) -> None:
|
||||
"""작업 등록 표 테스트 주차 비우기(로컬 테스트 DB — 앞선 실패한 실행의 줄이 남지 않게)."""
|
||||
with ST._pool.connection() as conn: # noqa: SLF001
|
||||
|
||||
Reference in New Issue
Block a user