fix(구조물표): 323-9 ③ M02 부품 끔 막힘 안내 — 형상 부품을 꺼서 형상이 「없음」이 된 것이면 「부품 「맹암거」 끔 — 이 부품을 쓰는 종류(A 횡단배수 · 맹암거)의 횡단도를 「안 만듦」으로 바꿔야 저장」 한 줄(부품 이름 + 쓰는 종류 전부) · 막음은 그대로 · 화면 · 서버 짝
- M02_SO_Def_Check.ts ↔ M02_SO_Check.py: 부품 끄기 전 표로 끈 탓 가름 · 부품마다 한 줄 - 시험: test_322_2_check_mirror(벽 끔 = 다섯 종류 한 줄 · 맹암거 끔 = A 횡단배수 · 맹암거 · 짝 같음) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ji4nuyLVHcxrXWHTdb5nRD
This commit is contained in:
@@ -104,13 +104,20 @@ def _row_errors(doc: dict[str, Any], before: dict[str, Any] | None) -> list[str]
|
|||||||
"""표 줄 — 218 규칙 · 부품 자리꼴 · 정본 · 읽는 칸 보임(새로 숨김만)."""
|
"""표 줄 — 218 규칙 · 부품 자리꼴 · 정본 · 읽는 칸 보임(새로 숨김만)."""
|
||||||
parts = load_parts()["parts"]
|
parts = load_parts()["parts"]
|
||||||
rows = resolve_catalog(doc)
|
rows = resolve_catalog(doc)
|
||||||
|
raw = resolve_catalog({**doc, "부품": {}}) # 부품 끄기 전 — 끈 탓 가름(323-9)
|
||||||
|
off_users: dict[str, list[str]] = {} # 끈 형상 부품 → 횡단도를 바꿔야 하는 종류
|
||||||
out: list[str] = []
|
out: list[str] = []
|
||||||
for t in doc.get("types") or []:
|
for t in doc.get("types") or []:
|
||||||
row = rows.get(t["type_id"])
|
row = rows.get(t["type_id"])
|
||||||
if row is None:
|
if row is None:
|
||||||
continue
|
continue
|
||||||
if row["shape"] == "none" and row["station"] != "none":
|
if row["shape"] == "none" and row["station"] != "none":
|
||||||
out.append(f"「{row['name']}」 형상이 「없음」이면 횡단도도 「안 만듦」")
|
was = raw[t["type_id"]]["shape"]
|
||||||
|
if was != "none" and (doc.get("부품") or {}).get(f"형상.{was}") is False:
|
||||||
|
label = f"{row['groupName']} · {row['name']}"
|
||||||
|
off_users.setdefault(was, []).append(label)
|
||||||
|
else:
|
||||||
|
out.append(f"「{row['name']}」 형상이 「없음」이면 횡단도도 「안 만듦」")
|
||||||
# 앞 판 없음 = 새로 숨긴 것 없음 · 복사한 종류 = 본보기가 앞 판에서 숨긴 칸도 그대로(323-7)
|
# 앞 판 없음 = 새로 숨긴 것 없음 · 복사한 종류 = 본보기가 앞 판에서 숨긴 칸도 그대로(323-7)
|
||||||
kept = [k for tid in (t["type_id"], row["base"]) for k in _hidden_in(before or doc, tid)]
|
kept = [k for tid in (t["type_id"], row["base"]) for k in _hidden_in(before or doc, tid)]
|
||||||
hidden = [key for key in _hidden_in(doc, t["type_id"]) if key not in kept]
|
hidden = [key for key in _hidden_in(doc, t["type_id"]) if key not in kept]
|
||||||
@@ -142,6 +149,12 @@ def _row_errors(doc: dict[str, Any], before: dict[str, Any] | None) -> list[str]
|
|||||||
f"「{row['name']}」 {branch} 「{name}」 이 쓰는 칸 「{labels[key]}」 — "
|
f"「{row['name']}」 {branch} 「{name}」 이 쓰는 칸 「{labels[key]}」 — "
|
||||||
"숨길 수 없음"
|
"숨길 수 없음"
|
||||||
)
|
)
|
||||||
|
for part_id, names in off_users.items():
|
||||||
|
name = short_name((parts["형상"].get(part_id) or {}).get("이름", part_id))
|
||||||
|
out.append(
|
||||||
|
f"부품 「{name}」 끔 — 이 부품을 쓰는 종류({', '.join(names)})의 "
|
||||||
|
"횡단도를 「안 만듦」으로 바꿔야 저장"
|
||||||
|
)
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -121,11 +121,17 @@ const hiddenIn = (doc: CheckDef | null, tid: string): string[] =>
|
|||||||
function rowErrors(doc: CheckDef, before: CheckDef | null): string[] {
|
function rowErrors(doc: CheckDef, before: CheckDef | null): string[] {
|
||||||
const out: string[] = [];
|
const out: string[] = [];
|
||||||
const rows = resolveCatalog(doc);
|
const rows = resolveCatalog(doc);
|
||||||
|
const raw = resolveCatalog({ ...doc, 부품: {} }); // 부품 끄기 전 — 끈 탓 가름(323-9)
|
||||||
|
const offUsers = new Map<string, string[]>(); // 끈 형상 부품 → 횡단도를 바꿔야 하는 종류
|
||||||
for (const t of doc.types ?? []) {
|
for (const t of doc.types ?? []) {
|
||||||
const row = rows.get(t.type_id);
|
const row = rows.get(t.type_id);
|
||||||
if (!row) continue;
|
if (!row) continue;
|
||||||
if (row.shape === "none" && row.station !== "none")
|
if (row.shape === "none" && row.station !== "none") {
|
||||||
out.push(`「${row.name}」 형상이 「없음」이면 횡단도도 「안 만듦」`);
|
const was = raw.get(t.type_id)?.shape ?? "none";
|
||||||
|
if (was !== "none" && doc.부품?.[`형상.${was}`] === false)
|
||||||
|
offUsers.set(was, [...(offUsers.get(was) ?? []), `${row.groupName} · ${row.name}`]);
|
||||||
|
else out.push(`「${row.name}」 형상이 「없음」이면 횡단도도 「안 만듦」`);
|
||||||
|
}
|
||||||
// 앞 판 없음 = 새로 숨긴 것 없음 · 복사한 종류 = 본보기가 앞 판에서 숨긴 칸도 그대로(323-7)
|
// 앞 판 없음 = 새로 숨긴 것 없음 · 복사한 종류 = 본보기가 앞 판에서 숨긴 칸도 그대로(323-7)
|
||||||
const kept = [t.type_id, row.base].flatMap((id) => hiddenIn(before ?? doc, id));
|
const kept = [t.type_id, row.base].flatMap((id) => hiddenIn(before ?? doc, id));
|
||||||
const hidden = hiddenIn(doc, t.type_id).filter((key) => !kept.includes(key));
|
const hidden = hiddenIn(doc, t.type_id).filter((key) => !kept.includes(key));
|
||||||
@@ -158,6 +164,12 @@ function rowErrors(doc: CheckDef, before: CheckDef | null): string[] {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
offUsers.forEach((names, id) =>
|
||||||
|
out.push(
|
||||||
|
`부품 「${shortName(partOf("형상", id)?.이름 ?? id)}」 끔 — 이 부품을 쓰는 종류(${names.join(", ")})의 ` +
|
||||||
|
"횡단도를 「안 만듦」으로 바꿔야 저장",
|
||||||
|
),
|
||||||
|
);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,9 @@ def _cases() -> dict[str, tuple[dict, dict | None]]:
|
|||||||
off = copy.deepcopy(real)
|
off = copy.deepcopy(real)
|
||||||
off["부품"] = {"형상.wall": False}
|
off["부품"] = {"형상.wall": False}
|
||||||
cases["parts_off"] = (off, real)
|
cases["parts_off"] = (off, real)
|
||||||
|
drain = copy.deepcopy(real)
|
||||||
|
drain["부품"] = {"형상.underdrain": False}
|
||||||
|
cases["underdrain_off"] = (drain, real)
|
||||||
return cases
|
return cases
|
||||||
|
|
||||||
|
|
||||||
@@ -140,8 +143,15 @@ def test_check_rules(ts: dict) -> None:
|
|||||||
"「반사경」 군 글자 — 만든 뒤 고정",
|
"「반사경」 군 글자 — 만든 뒤 고정",
|
||||||
"종류 「기타」 — 지울 수 없음",
|
"종류 「기타」 — 지울 수 없음",
|
||||||
]
|
]
|
||||||
# 형상 부품을 끄면 벽 다섯은 형상 none — 횡단도도 none 으로 바꿔야 저장됨
|
# 형상 부품을 끄면 쓰는 종류 형상 none — 부품 이름 + 쓰는 종류 전부 한 줄(323-9)
|
||||||
assert len(got["parts_off"]) == 5 and all("횡단도도 「안 만듦」" in t for t in got["parts_off"])
|
walls = "옹벽, 돌쌓기(찰), 돌쌓기(메), 흙막이, 큰돌쌓기".split(", ")
|
||||||
|
assert got["parts_off"] == [
|
||||||
|
f"부품 「벽」 끔 — 이 부품을 쓰는 종류({', '.join(f'C 사면안정 · {w}' for w in walls)})의 "
|
||||||
|
"횡단도를 「안 만듦」으로 바꿔야 저장"
|
||||||
|
]
|
||||||
|
assert got["underdrain_off"] == [
|
||||||
|
"부품 「맹암거」 끔 — 이 부품을 쓰는 종류(A 횡단배수 · 맹암거)의 횡단도를 「안 만듦」으로 바꿔야 저장"
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def test_reflect_edits(ts: dict) -> None:
|
def test_reflect_edits(ts: dict) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user