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"]