From fab776eb311f3d2c228bc10a84fa95ab6f80acf2 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Tue, 13 Oct 2026 20:31:32 +0900 Subject: [PATCH] =?UTF-8?q?fix(b06):=20=EA=B5=AC=EC=A1=B0=EB=AC=BC=20?= =?UTF-8?q?=EC=A2=85=EB=A5=98=EB=A5=BC=20=EC=97=AC=EB=9F=AC=20=EB=B2=88=20?= =?UTF-8?q?=EB=B0=94=EA=BE=B8=EB=A9=B4=20=EC=95=9E=20=EC=A2=85=EB=A5=98=20?= =?UTF-8?q?=EC=A0=9C=EC=9B=90=EC=9D=B4=20=EB=82=A8=EC=95=84=20=EA=B2=B9?= =?UTF-8?q?=EC=B9=98=EB=8D=98=20=EA=B2=83=20=E2=80=94=20=EB=AF=B8=EB=A6=AC?= =?UTF-8?q?=20=EB=9C=AC=20=ED=9A=A1=EB=8B=A8=EC=9D=80=20=EB=8B=A4=EC=8B=9C?= =?UTF-8?q?=20=EC=93=B0=EB=AF=80=EB=A1=9C=20=EC=96=B9=EA=B8=B0=20=EC=A0=84?= =?UTF-8?q?=EC=97=90=20=EA=B4=80=20=EA=B3=84=EC=97=B4=20=EC=A0=9C=EC=9B=90?= =?UTF-8?q?=EC=9D=84=20=EB=B9=84=EC=9B=80=20(317-3=20=C2=B7=20=EC=9A=94?= =?UTF-8?q?=EA=B5=AC=20214)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01C6BNBFXFndbqYxu6sZuknK --- B06_Section/B06_Section_Section_Drafts.ts | 5 +++++ resources/tester/helper_317_kind_change_station.cjs | 11 +++++++++++ resources/tester/test_317_kind_change_station.py | 6 ++++++ 3 files changed, 22 insertions(+) diff --git a/B06_Section/B06_Section_Section_Drafts.ts b/B06_Section/B06_Section_Section_Drafts.ts index 1778426f0..29df199eb 100644 --- a/B06_Section/B06_Section_Section_Drafts.ts +++ b/B06_Section/B06_Section_Section_Drafts.ts @@ -124,6 +124,11 @@ function decorate( const own = pipes.filter((pipe) => fresh.some((section) => near(section.chainage_m, pipe.chainage_m)), ); + // 미리 뜬 횡단은 한 벌을 기억해 다시 씀 — 얹기 전에 관 계열 제원을 비움(앞 종류 제원이 남아 + // 겹치던 것 · 서버가 얹어 온 저장분 종류도 · 열쇠 = `Section_Store` FACILITY_KEYS 와 같음 · 317-3) + for (const section of fresh as unknown as Array>) { + for (const key of ["culvert", "ford", "box", "ford_pavement"]) delete section[key]; + } attachCulvertSets( fresh as unknown as Array>, buildCulvertSets(own, registry), diff --git a/resources/tester/helper_317_kind_change_station.cjs b/resources/tester/helper_317_kind_change_station.cjs index cb92ed9e5..a26ffa7d0 100644 --- a/resources/tester/helper_317_kind_change_station.cjs +++ b/resources/tester/helper_317_kind_change_station.cjs @@ -71,6 +71,17 @@ const snap = () => ({ state.draftPipes = [{ chainage_m: 50, facility: "ford_pavement" }]; await withDraftStations(detail, "p1", 1); out.back_to_saved = snap(); + // 여러 번 바꿈 — 앞 종류 제원이 남아 겹치지 않음(317-3 · 미리 뜬 횡단은 한 벌을 다시 씀) + const facilityKeys = () => + Object.keys(at50() ?? {}) + .filter((key) => ["culvert", "ford", "box", "ford_pavement"].includes(key)) + .sort(); + state.draftPipes = [{ chainage_m: 50, facility: "box_culvert" }]; + await withDraftStations(detail, "p1", 1); + out.first_switch = facilityKeys(); + state.draftPipes = [{ chainage_m: 50, facility: "ford_bridge" }]; + await withDraftStations(detail, "p1", 1); + out.second_switch = facilityKeys(); forgetDraftStations("p1"); process.stdout.write(JSON.stringify(out)); })().catch((error) => { diff --git a/resources/tester/test_317_kind_change_station.py b/resources/tester/test_317_kind_change_station.py index c143904b7..6323ead84 100644 --- a/resources/tester/test_317_kind_change_station.py +++ b/resources/tester/test_317_kind_change_station.py @@ -47,3 +47,9 @@ def test_changed_kind_starts_from_fresh_section(result: dict) -> None: def test_back_to_saved_kind_restores_saved_section(result: dict) -> None: assert result["back_to_saved"] == {"count": 2, "fresh": False, "old": True, "preview": False} + + +def test_repeated_switch_leaves_no_old_kind(result: dict) -> None: + # 박스 → 세월교 — 앞 종류(박스) 제원이 남아 겹치지 않음(317-3) + assert result["first_switch"] == ["box"] + assert result["second_switch"] == ["ford"]