fix(종단보기): 346-3 덧 계획고 초안 이음매 — 노선 저장 뒤 노선 초안 칸(DRAFT_ROUTE_ID 0 · sub7) 계획고를 새 노선으로 · 없으면 옛 노선 칸 · 두 칸 다 비움
- design_save 의 DRAFT_ROUTE_ID = design_pipeline_page 값과 같음(합친 뒤 시험이 대조) - 시험: test_design_store_save 덧 하나 · 관련 52 통과 · typecheck 통과 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VmC34fsxxbweEG3RUjs3Mn
This commit is contained in:
@@ -101,17 +101,23 @@ export function noticeDroppedEdits(saved: { dropped_edit_chainages?: number[] })
|
||||
);
|
||||
}
|
||||
|
||||
/** 노선 초안 동안의 계획고 초안 칸 — `design_pipeline_page` 의 `DRAFT_ROUTE_ID` 와 같은 값(sub7). */
|
||||
const DRAFT_ROUTE_ID = 0;
|
||||
|
||||
/** 계획고 초안(가게 하나)을 종단 정본에 쓴다. 없으면 아무 일도 하지 않는다. 노선이 바뀌었으면
|
||||
* 옛 노선 칸(`from`)의 초안을 새 노선(`routeId`)에 — 측점이 없는 자리는 서버가 버리고 알림(213-2). */
|
||||
* 노선 초안 칸(`DRAFT_ROUTE_ID`) · 없으면 옛 노선 칸(`from`)의 초안을 새 노선(`routeId`)에 · 두 칸 다
|
||||
* 비움 — 측점이 없는 자리는 서버가 버리고 알림(213-2). */
|
||||
async function flushAlignmentDraft(
|
||||
projectId: string,
|
||||
routeId: number,
|
||||
from: number = routeId,
|
||||
): Promise<void> {
|
||||
const draft = pendingAlignment(from);
|
||||
const moved = from !== routeId;
|
||||
const draft = (moved ? pendingAlignment(DRAFT_ROUTE_ID) : null) ?? pendingAlignment(from);
|
||||
if (!draft) return;
|
||||
noticeDroppedEdits(await saveProfileAlignment(projectId, routeId, draft));
|
||||
markAlignmentSaved(from);
|
||||
if (moved) markAlignmentSaved(DRAFT_ROUTE_ID);
|
||||
}
|
||||
|
||||
/** 실패해도 다음 차례로 넘어가는 창구와 그 이름(보기가 준 일에도 같이 씌운다). */
|
||||
|
||||
@@ -225,6 +225,21 @@ async function run() {
|
||||
{ confirm: true },
|
||||
);
|
||||
out.routeConfirmCalls = [...calls];
|
||||
// ⑨ 노선 초안 동안 계획고 = 노선 0 칸(sub7 DRAFT_ROUTE_ID) — 그 칸이 새 노선에 나가고 두 칸 다 비움
|
||||
b05.replace({ station_offsets: { "30.000": 0.2 }, curve_radii: {} }); // 옛 노선(7) 초안
|
||||
useDesignStore(null, 0).set("alignmentDraft", {
|
||||
station_offsets: { "35.000": 0.4 },
|
||||
curve_radii: {},
|
||||
});
|
||||
calls.length = 0;
|
||||
await saveDesign({
|
||||
projectId: "p1",
|
||||
routeId: () => 7,
|
||||
cross: async (confirm) => calls.push(`cross:${confirm}`),
|
||||
failed: () => calls.push("failed"),
|
||||
});
|
||||
out.draftRouteCalls = calls.filter((c) => c.startsWith("alignment:"));
|
||||
out.draftRouteLeft = { draft: edit.pendingAlignment(0), old: edit.pendingAlignment(7) };
|
||||
routeBody = null;
|
||||
|
||||
// ⑤ [초기화] — 초안 · 한 벌 모두 버림
|
||||
|
||||
@@ -126,3 +126,17 @@ def test_확정_중_노선이_바뀌면_다시_세우고_확정은_다시(out):
|
||||
calls = out["routeConfirmCalls"]
|
||||
assert calls[1] == "route" and calls[-2:] == ["rebuild", "overlay:off"]
|
||||
assert "done:true" not in calls and "cross:true" not in calls
|
||||
|
||||
|
||||
def test_노선_초안_칸_계획고가_새_노선으로(out):
|
||||
"""346-3 덧 — 노선 초안 동안 계획고는 노선 0 칸(sub7) · 노선 저장 뒤 그 칸이 새 노선 9 로 · 0 · 7 칸 다 비움."""
|
||||
assert out["draftRouteCalls"] == ['alignment:9:{"35.000":0.4}']
|
||||
assert out["draftRouteLeft"] == {"draft": None, "old": None}
|
||||
design = os.path.join(HERE, "..", "..", "A00_Common", "design")
|
||||
with open(os.path.join(design, "design_pipeline_page.ts"), encoding="utf-8") as f:
|
||||
pipeline = f.read()
|
||||
with open(os.path.join(design, "design_save.ts"), encoding="utf-8") as f:
|
||||
save = f.read()
|
||||
assert "const DRAFT_ROUTE_ID = 0;" in save
|
||||
if "export const DRAFT_ROUTE_ID" in pipeline: # 합친 뒤 — 두 값이 같아야 함
|
||||
assert "export const DRAFT_ROUTE_ID = 0;" in pipeline
|
||||
|
||||
Reference in New Issue
Block a user