From 51b7594ee0fb0a6c0c899939f37a89eb3949f261 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Wed, 18 Nov 2026 22:50:54 +0900 Subject: [PATCH] =?UTF-8?q?refactor(859-2=20=E3=89=AE-3):=20=ED=94=84?= =?UTF-8?q?=EB=A1=9C=EC=A0=9D=ED=8A=B8=20=EC=AA=BD=20=E3=80=8C=EB=A7=88?= =?UTF-8?q?=EC=8A=A4=ED=84=B0=EA=B0=80=20=EB=B0=94=EB=80=9C=E3=80=8D=20?= =?UTF-8?q?=ED=91=9C=EC=8B=9C=20=EA=B1=B7=EC=9D=8C=20=E2=80=94=20=EA=B5=AC?= =?UTF-8?q?=EC=A1=B0=EB=AC=BC=20=EA=B3=A0=EB=A5=B4=EA=B8=B0=20=EC=B0=BD=20?= =?UTF-8?q?=C2=B7=20B08=20=EC=A1=B0=ED=95=A9=20=EC=97=B0=EA=B2=B0=20?= =?UTF-8?q?=EC=B9=B8=20=C2=B7=20=EC=84=9C=EB=B2=84=20=EC=9B=90=EB=B3=B8=20?= =?UTF-8?q?=EB=8C=80=EC=A1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 고르기 창 상태 줄 「마스터가 바뀜」 배지 걷음 · [재적용] 그대로 - B08 「구조물 조합 고르기」 칩: 「마스터가 바뀜」 배지 · 노랑 테두리 걷음 · [업데이트] = 원본이 있으면 늘 켬(다시 가져올지는 사용자가) · 호버 「원본을 다시 가져와 이 사본에 덮음」 · 글 키 둘 걷음 - 서버 `M02_Item_Copy.list_items`: `마스터바뀜`(원본 다시 모아 판 대조) 걷고 `원본없음` 만 — `source_changed` → `source_gone` - 시험: 마스터바뀜 단언만 걷음(156_2 · item_copy_complete · item_picker_detail · m02_empty_master) · 원본판 · 재적용 단언 그대로 Co-Authored-By: Claude Opus 5.5 --- B08_Quantity/B08_Quantity_UI_Link.ts | 27 +++++++------------ M02_MasterTemplete/M02_Item_Copy.py | 14 +++++----- M02_MasterTemplete/M02_Item_Source.py | 2 +- .../M02_Project_Items_Router.py | 2 +- .../tester/helper_item_picker_project.cjs | 2 +- resources/tester/test_156_2_picker_speed.py | 5 ++-- resources/tester/test_item_copy_complete.py | 5 +--- resources/tester/test_item_picker_detail.py | 1 - resources/tester/test_m02_empty_master.py | 2 +- ui_template/ui_template_item_picker_detail.ts | 2 -- .../ui_template_item_picker_project.ts | 7 ++--- ui_template/ui_template_locale_b4.ts | 9 ++----- 12 files changed, 26 insertions(+), 52 deletions(-) diff --git a/B08_Quantity/B08_Quantity_UI_Link.ts b/B08_Quantity/B08_Quantity_UI_Link.ts index 6d5e359df..e5f9e4d2b 100644 --- a/B08_Quantity/B08_Quantity_UI_Link.ts +++ b/B08_Quantity/B08_Quantity_UI_Link.ts @@ -6,8 +6,9 @@ * [선택] → 공용 고르기 모달(`openItemPicker` · 누를 때 `import()`) → 바로 저장 * = PUT …/items/{사본 id}/link(그 칸 하나만 정본에 · 서버가 사본 맞춤) → 집계표 다시 셈 * [연결 끊기](연결된 칸만) → 확인 창 → 같은 길에 null(그 칸만 비움 · 사본 폴더 그대로 · 156-1) - * [업데이트](연결된 칸만 · 163-4) = 칩 그린 뒤 `list(사본 폴더)` 로 배지(마스터가 바뀜 · 고침 있음 · - * 원본이 없어짐) · 마스터가 바뀜일 때만 켬 → 확인 창 → 고르기 모달 [재적용]과 같은 길(`reapply`) + * [업데이트](연결된 칸만 · 163-4) = 칩 그린 뒤 `list(사본 폴더)` 로 배지(고침 있음 · 원본이 없어짐) · + * 원본이 있으면 켬(859-2 「마스터 바뀜」 표시 걷음 · 다시 가져올지는 사용자가) → 확인 창 → + * 고르기 모달 [재적용]과 같은 길(`reapply`) * 단추 = 작은 ghost(칩 안 · 163-1) * B05/B06 세션 초안(구조물 · 관)이 있으면 막고 알림 — 그쪽 [저장]이 목록 통째로 덮어 연결이 사라짐 * ========================================================================== */ @@ -103,16 +104,15 @@ async function update(projectId: string, info: ProjectItemInfo): Promise = { "is-linked": "success", "is-missing": "danger", - "is-changed": "warning", "is-edited": "info", "is-gone": "danger", }; -/** 칩 = 부품 배지(알약 20) 꼴 · 색 = 상태(연결 초록 · 미연결 빨강 · 바뀜 노랑 · 고침 파랑 · 없어짐 빨강 점선) */ +/** 칩 = 부품 배지(알약 20) 꼴 · 색 = 상태(연결 초록 · 미연결 빨강 · 고침 파랑 · 없어짐 빨강 점선) */ function toneChip(chip: HTMLElement, state: ChipState): void { const look = createBadge("", CHIP_TONE[state], { size: 20 }); chip.className = `${look.className} b08-link__chip ${state}`; @@ -137,20 +137,11 @@ async function paintCopyState( createBadge(L(key), warn ? "warning" : "neutral", { size: 18 }); if (info.고침) badges.append(badge("B08_Quantity_Link_Edited", false)); if (info.원본없음) badges.append(badge("B08_Quantity_Link_Gone", true)); - else if (info.마스터바뀜) badges.append(badge("B08_Quantity_Link_Changed", true)); - // 테두리 상태 색(170-3) — 앞섬 = 없어짐 › 바뀜 › 고침 › 연결 - const tone = info.원본없음 - ? "is-gone" - : info.마스터바뀜 - ? "is-changed" - : info.고침 - ? "is-edited" - : null; + // 테두리 상태 색(170-3) — 앞섬 = 없어짐 › 고침 › 연결 + const tone = info.원본없음 ? "is-gone" : info.고침 ? "is-edited" : null; if (tone) toneChip(chip, tone); - button.disabled = !info.마스터바뀜 || !!info.원본없음; - button.title = button.disabled - ? L("B08_Quantity_Link_UpdateSame") - : L("B08_Quantity_Link_UpdateTip"); + button.disabled = !!info.원본없음; + button.title = L(button.disabled ? "B08_Quantity_Link_Gone" : "B08_Quantity_Link_UpdateTip"); return info; } diff --git a/M02_MasterTemplete/M02_Item_Copy.py b/M02_MasterTemplete/M02_Item_Copy.py index 715a1a85d..0091e147b 100644 --- a/M02_MasterTemplete/M02_Item_Copy.py +++ b/M02_MasterTemplete/M02_Item_Copy.py @@ -76,13 +76,13 @@ def folder_of(project_root: str | Path, folder: str) -> Path: return target -def source_changed(manifest: dict[str, Any]) -> bool | None: - """지금 원본(층 · 마스터)을 다시 모은 판이 가져온 판과 다른가 — 원본이 없어졌으면 None.""" +def source_gone(manifest: dict[str, Any]) -> bool: + """원본(층 · 마스터)이 없어졌나 — 다시 모으지 못하면 참(859-2 「마스터 바뀜」 대조 걷음).""" try: - source = build_source(manifest["원본"]) + build_source(manifest["원본"]) except (LookupError, ValueError, KeyError): - return None - return version_of(source) != manifest.get("원본판") + return True + return False def list_items(project_root: str | Path, only: str | None = None) -> list[dict[str, Any]]: @@ -98,7 +98,6 @@ def list_items(project_root: str | Path, only: str | None = None) -> list[dict[s continue manifest = read_json(child / MANIFEST_NAME) or {} origin = manifest.get("원본") or {} - changed = source_changed(manifest) out.append( { "폴더": child.name, @@ -106,8 +105,7 @@ def list_items(project_root: str | Path, only: str | None = None) -> list[dict[s "원본": origin, "원본판": manifest.get("원본판"), "가져온날": manifest.get("가져온날"), - "마스터바뀜": bool(changed), - "원본없음": changed is None, + "원본없음": source_gone(manifest), "구조물": manifest.get("구조물") or [], "고침": bool(manifest.get("고침")), "값있음": bool(manifest.get("값있음")), diff --git a/M02_MasterTemplete/M02_Item_Source.py b/M02_MasterTemplete/M02_Item_Source.py index fd7546ce3..02ae8a4b9 100644 --- a/M02_MasterTemplete/M02_Item_Source.py +++ b/M02_MasterTemplete/M02_Item_Source.py @@ -7,7 +7,7 @@ + 담은 로직 줄(M01 시스템) + 알약(가져온 때 그대로) + 참조사본(단가승격 · 사전조합을 값으로 굳힘 · 단가산출 SK = 수식 문서 사본 따로 · 855-F B9-5) · `단가.json` 계산에 닿는 마스터 줄 전부(담은 로직 + 일위대가 자재 MT) -`원본판` = 모은 내용의 해시 — 지금 층 · 마스터에서 다시 모은 판과 대어 「마스터가 바뀜」 을 앎. +`원본판` = 모은 내용의 해시(가져온 때 기록 · 859-2 「마스터가 바뀜」 대조 걷음). 프로젝트가 고치는 값(`입력값.json` · `고른자재.json`)은 원본이 아니라 여기서 안 모음. 원본 층 자리 = `M02_Template_Layers` 경로 · 일위대가 · 단가는 M01 시스템 것. """ diff --git a/M02_MasterTemplete/M02_Project_Items_Router.py b/M02_MasterTemplete/M02_Project_Items_Router.py index b532cd6e6..b020f1c67 100644 --- a/M02_MasterTemplete/M02_Project_Items_Router.py +++ b/M02_MasterTemplete/M02_Project_Items_Router.py @@ -1,7 +1,7 @@ """프로젝트 구조물 집계 항목 복사본 길 — `/api/projects/{id}/items…` (PLAN 25-1b · 26-1 · 26-2b). 폴더 = 구조물 id(`structure_id` · 관 지점은 `pipe@측점`) — 같은 항목을 고른 구조물도 복사본은 따로. - GET …/items[?folder=] 목록(원본 · 가져온날 · 마스터바뀜 · 원본없음) · + GET …/items[?folder=] 목록(원본 · 가져온날 · 원본없음 · 859-2 마스터바뀜 걷음) · folder = 그 폴더 하나만(고르기 모달) POST …/items {structure, layer, owner, key} 미리 가져오기 → {폴더, 만듦, 가져온날} POST …/items/new {structure, 경로, 이름, 단위} 새 항목(개인 층에도) · 회사 없음 409 diff --git a/resources/tester/helper_item_picker_project.cjs b/resources/tester/helper_item_picker_project.cjs index 350a58372..96845e126 100644 --- a/resources/tester/helper_item_picker_project.cjs +++ b/resources/tester/helper_item_picker_project.cjs @@ -98,7 +98,7 @@ globalThis.fetch = async (url, init = {}) => { return reply(400, { detail: "미리 가져올 구조물(structure)이 필요합니다." }); const folder = body.structure.replace("#", "n"); state.folders[folder] = { - info: { 폴더: folder, 원본: body, 마스터바뀜: false, 가져온날: "2026-09-30T01:00:00" }, + info: { 폴더: folder, 원본: body, 가져온날: "2026-09-30T01:00:00" }, parts: { 면적: { 시트: [{ id: "s", 칸: { A1: { 값: 1 } } }] }, 입력값: null, diff --git a/resources/tester/test_156_2_picker_speed.py b/resources/tester/test_156_2_picker_speed.py index 297323367..aa109abe4 100644 --- a/resources/tester/test_156_2_picker_speed.py +++ b/resources/tester/test_156_2_picker_speed.py @@ -51,8 +51,8 @@ def test_목록_folder_는_그_하나만_값은_통째와_같음(world, monkeypa whole = {row["폴더"]: row for row in copies.list_items(root)} assert set(whole) == {"pipe@40.0", "pipe@80.0"} calls: list[Any] = [] - real = copies.source_changed - monkeypatch.setattr(copies, "source_changed", lambda m: calls.append(m) or real(m)) + real = copies.source_gone + monkeypatch.setattr(copies, "source_gone", lambda m: calls.append(m) or real(m)) assert copies.list_items(root, "pipe@80.0") == [whole["pipe@80.0"]] assert len(calls) == 1 # 원본 대조 = 그 하나만 assert copies.list_items(root, "없음") == [] @@ -104,7 +104,6 @@ def test_기억을_비워도_단가_묶음_원본판_같음(world, monkeypatch): monkeypatch.setattr(prices, "_FOUND", (None, {})) for folder, item in (("pipe@40.0", PIPE), ("pipe@80.0", WALL)): assert version_of(build_source(item)) == before[folder] - assert not any(row["마스터바뀜"] for row in copies.list_items(root)) def test_목록_시간_상한(world): # noqa: F811 diff --git a/resources/tester/test_item_copy_complete.py b/resources/tester/test_item_copy_complete.py index 2694d380e..39b8be6fa 100644 --- a/resources/tester/test_item_copy_complete.py +++ b/resources/tester/test_item_copy_complete.py @@ -136,7 +136,6 @@ def test_지정하면_새_파일까지_복사(world): "원본": {**PIPE, "경로": PIPE_PATH}, "원본판": manifest["원본판"], "가져온날": manifest["가져온날"], - "마스터바뀜": False, "원본없음": False, "구조물": ["pipe@40.0"], "고침": False, @@ -206,13 +205,11 @@ def test_마스터_단가를_바꿔도_계산_그대로_새로_가져오면_바 row["값"] = row["값"] * 2 labor_file.write_text(json.dumps(data, ensure_ascii=False), encoding="utf-8") assert copies.calc(root, FOLDER) == before # 복사본만 씀 - assert copies.list_items(root)[0]["마스터바뀜"] is True copies.refresh(root, FOLDER) after = copies.calc(root, FOLDER) assert after["기준합"]["노무비"] > before["기준합"]["노무비"] assert after["기준합"]["재료비"] == before["기준합"]["재료비"] assert copies.read_file(root, FOLDER, "입력값")["내용"] == values # 같은 키 살림 - assert copies.list_items(root)[0]["마스터바뀜"] is False finally: labor_file.write_bytes(original) @@ -394,7 +391,7 @@ def test_원본_항목을_지워도_복사본_계산_그대로(world): (system / layers.COMBO_FILE).write_text(json.dumps(combo, ensure_ascii=False), "utf-8") assert copies.calc(root, FOLDER) == before row = copies.list_items(root)[0] - assert row["원본없음"] is True and row["마스터바뀜"] is False + assert row["원본없음"] is True assert _save(root, [_pipe()])["만듦"] == [] # 다시 저장해도 복사본 그대로 with pytest.raises(LookupError): copies.reapply(root, FOLDER) # 원본이 없으면 재적용 못 함(404) diff --git a/resources/tester/test_item_picker_detail.py b/resources/tester/test_item_picker_detail.py index 33eda500d..c76b80048 100644 --- a/resources/tester/test_item_picker_detail.py +++ b/resources/tester/test_item_picker_detail.py @@ -81,7 +81,6 @@ def test_판이_달라지면_409_까닭_권한_없으면_서버_까닭_그대로 def test_재적용은_덮임을_돌려주고_계산_한_줄(out): assert out["reapplyCall"][0] == "POST /api/projects/P1/items/pipe%4085.05/reapply" assert out["reapply"]["covered"] == ["면적"] # 덮이는 것을 알림으로 - assert out["reapply"]["info"]["마스터바뀜"] is False # 142-1 — 계 = 반영합 · 빈 값 = 빠진입력 · 못 돈 줄 = 까닭 있는 줄 assert out["calc"] == {"total": 300, "gaps": 2, "stuck": 1, "base": 100, "reflected": 300} assert out["calcMissing"] is None # 없는 복사본 = 계산 줄 없음 diff --git a/resources/tester/test_m02_empty_master.py b/resources/tester/test_m02_empty_master.py index 1cd51349d..1113a07c6 100644 --- a/resources/tester/test_m02_empty_master.py +++ b/resources/tester/test_m02_empty_master.py @@ -127,4 +127,4 @@ def test_마스터를_비워도_프로젝트_복사본_계산_그대로(world): assert len(empty_master(system)) == 51 assert copies.calc(root, FOLDER) == before row = copies.list_items(root)[0] - assert row["원본없음"] is True and row["마스터바뀜"] is False + assert row["원본없음"] is True diff --git a/ui_template/ui_template_item_picker_detail.ts b/ui_template/ui_template_item_picker_detail.ts index 2df87d9ce..17d630512 100644 --- a/ui_template/ui_template_item_picker_detail.ts +++ b/ui_template/ui_template_item_picker_detail.ts @@ -86,7 +86,6 @@ const TEXT = { "이 구조물의 복사본 「{value}」 에서 고친 것이 있음 — 이 항목으로 바꾸면 그 고침은 _지난 폴더로 옮겨짐. 바꿀까요?", imported: "이 구조물 복사본 · 가져옴 {value}", edited: "고침 있음", - changed: "마스터가 바뀜 — 복사본은 가져온 때 그대로", gone: "원본이 없어짐 — 복사본은 그대로 씀", reapply: "재적용", reapplyTip: "원본을 다시 가져옴 — 이 구조물 복사본에서 고친 것(도면 · 시트)이 원본 것으로 덮임", @@ -229,7 +228,6 @@ export function createItemDetail(opts: ItemDetailOptions): ItemDetail { nodes.push(fill(TEXT.imported, dateOf(info.가져온날))); if (info.고침) nodes.push(badge(TEXT.edited)); if (info.원본없음) nodes.push(badge(TEXT.gone, "is-warn")); - else if (info.마스터바뀜) nodes.push(badge(TEXT.changed, "is-warn")); const reapply = createButton({ label: TEXT.reapply, variant: "ghost", size: "sm" }); reapply.title = TEXT.reapplyTip; reapply.disabled = !!info.원본없음; diff --git a/ui_template/ui_template_item_picker_project.ts b/ui_template/ui_template_item_picker_project.ts index 0b800712d..707ce1fe8 100644 --- a/ui_template/ui_template_item_picker_project.ts +++ b/ui_template/ui_template_item_picker_project.ts @@ -3,7 +3,7 @@ * 항목 고르기 모달의 **자료 창구**(계획서 25-2d) — 프로젝트 복사본 · 입력 목록 · 계산을 한 곳에서 부름. * * 구조물 복사본(sub6 · 26-1 · 26-2b) — 폴더 = 구조물 id(같은 항목을 고른 구조물도 복사본은 따로) - * GET /api/projects/{id}/items[?folder=] → {항목: [{폴더, 이름, 원본, 원본판, 가져온날, 마스터바뀜, 원본없음, …}]} · folder = 그 하나만 + * GET /api/projects/{id}/items[?folder=] → {항목: [{폴더, 이름, 원본, 원본판, 가져온날, 원본없음, …}]} · folder = 그 하나만 * POST /api/projects/{id}/items {structure, layer, owner, key} 미리 가져오기 → {폴더, 만듦, 가져온날} * POST /api/projects/{id}/items/new {structure, 경로, 이름, 단위} 새 항목(개인 층에도) → {…, summary_item} * GET|PUT /api/projects/{id}/items/{폴더}/{부분} → {종류, 판, 내용} · 고침은 {판, 내용}(판이 다르면 409) @@ -37,8 +37,6 @@ export interface ProjectItemInfo { 원본: { layer: string; owner: string | null; key: string; name?: string }; 원본판?: string | null; 가져온날?: string | null; - /** 원본(마스터 · 회사 · 개인)이 가져온 뒤 바뀜 */ - 마스터바뀜?: boolean; 원본없음?: boolean; 구조물?: string[]; 고침?: boolean; @@ -200,7 +198,7 @@ export function projectItems(projectId: string): ProjectItems { if (reply.status >= 300) throw new Error(reasonOf(reply)); const got = reply.body as { 폴더: string; 가져온날?: string | null }; forget(got.폴더); - return { 폴더: got.폴더, 원본: ref, 가져온날: got.가져온날, 마스터바뀜: false }; + return { 폴더: got.폴더, 원본: ref, 가져온날: got.가져온날 }; }, reapply: async (info) => { const reply = await call(`${base}/${enc(info.폴더)}/reapply`, post({})); @@ -216,7 +214,6 @@ export function projectItems(projectId: string): ProjectItems { ...info, 가져온날: got.가져온날, 원본판: got.원본판, - 마스터바뀜: false, 고침: false, }, covered: got.덮임 ?? [], diff --git a/ui_template/ui_template_locale_b4.ts b/ui_template/ui_template_locale_b4.ts index 856ce208f..dd6df9ced 100644 --- a/ui_template/ui_template_locale_b4.ts +++ b/ui_template/ui_template_locale_b4.ts @@ -85,12 +85,8 @@ export const ui_locales_b4 = { B08_Quantity_Link_UnlinkFailed: ["연결을 끊지 못했습니다", "Failed to unlink"], B08_Quantity_Link_Update: ["업데이트", "Update"], B08_Quantity_Link_UpdateTip: [ - "마스터가 바뀜 — 원본을 다시 가져와 이 사본에 덮음", - "The master changed — re-import the source into this copy", - ], - B08_Quantity_Link_UpdateSame: [ - "원본과 같음 — 업데이트할 것 없음", - "Same as the source — nothing to update", + "원본을 다시 가져와 이 사본에 덮음", + "Re-import the source into this copy", ], B08_Quantity_Link_UpdateAsk: [ "원본을 다시 가져와 이 사본에 덮습니다 — 입력값 · 고른 자재는 살리고(같은 키) 도면 · 면적산출 · 일위대가는 원본 것으로 덮습니다.", @@ -106,7 +102,6 @@ export const ui_locales_b4 = { "Updated — nothing overwritten (same as the source)", ], B08_Quantity_Link_UpdateFailed: ["업데이트하지 못했습니다", "Failed to update"], - B08_Quantity_Link_Changed: ["마스터가 바뀜", "Master changed"], B08_Quantity_Link_Edited: ["고침 있음", "Edited"], B08_Quantity_Link_Gone: ["원본이 없어짐", "Source gone"], B08_Quantity_Link_Pending: [