fix(m01-sl): 표 상자에 표 번호 안 보이게 — 시트 이름 · 찾기 판 머리를 표 이름으로 · 표 줄 수 따라가기
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019ACSGaHdLgnkEkoA4LDtMU
This commit is contained in:
@@ -31,11 +31,21 @@ const jobs = JSON.parse(fs.readFileSync(0, "utf8"));
|
||||
const out = jobs.map((job) => {
|
||||
if (job.op === "plan") {
|
||||
const plan = m.planLookup(job.info, job.roles);
|
||||
const cells = { ...m.blockCells(job.info), ...plan.cells };
|
||||
const cells = { ...m.blockCells(job.blockInfo || job.info), ...plan.cells };
|
||||
for (const [c, v] of Object.entries(job.inputs || {})) cells[plan.inCells[c]] = { 값: v };
|
||||
return { cells, plan };
|
||||
}
|
||||
if (job.op === "paste") return m.parsePaste(job.text);
|
||||
if (job.op === "rename") {
|
||||
const sl = { key: null, name: "t", resultUnit: "", edges: [],
|
||||
workbook: { 종류: "통합문서", 판: 1, 열: "t", 서식: [{}], 시트: [
|
||||
{ id: "s1", 이름: "표", 칸: {} },
|
||||
{ id: "s2", 이름: "계산", 칸: { B2: { 식: "'표'!G7*2" }, B3: { 식: "표!G7+1" } } } ] },
|
||||
nodes: [{ id: "n1", kind: "table", name: "표", sheetId: "s1", pillsIn: [], pillsOut: [], stage: 1 }] };
|
||||
const done = m.applyTable(sl, "n1", job.info, job.roles, { ref: job.info.key, fillBlock: false, outside: true }).sl;
|
||||
const texts = Object.values(done.workbook.시트[0].칸).map((c) => String(c.값 ?? ""));
|
||||
return { sheets: done.workbook.시트.map((x) => x.이름), refs: done.workbook.시트[1].칸, ref: done.nodes[0].ref, node: done.nodes[0].name, texts };
|
||||
}
|
||||
if (job.op === "reapply") {
|
||||
const base = { key: null, name: "t", resultUnit: "원/㎡", edges: [],
|
||||
workbook: { 종류: "통합문서", 판: 1, 열: "t", 서식: [{}], 시트: [{ id: "s1", 이름: "표", 칸: {} }] },
|
||||
@@ -230,3 +240,37 @@ def test_블록_머리_차례():
|
||||
"폭·아래",
|
||||
"폭·위",
|
||||
]
|
||||
|
||||
|
||||
def test_표가_늘어도_찾기_범위가_따라감():
|
||||
"""마스터 표 줄이 시험 때보다 늘었을 때 — 찾기 판이 만든 줄 수 밖 새 줄도 찾음(범위 표 · 같음 표 둘 다)."""
|
||||
small = {**RATE, "rows": RATE["rows"][:2]}
|
||||
extra = [{"높이": [5.5 + i, 6.5 + i], "증가율": 70 + i} for i in range(5)]
|
||||
grown = {**small, "rows": [*small["rows"], *extra]}
|
||||
roles = {"cond": ["높이"], "out": ["증가율"]}
|
||||
plan = run(
|
||||
[{"op": "plan", "info": small, "roles": roles, "inputs": {"높이": 8.5}, "blockInfo": grown}]
|
||||
)[0]
|
||||
book = {
|
||||
"종류": "통합문서",
|
||||
"판": 1,
|
||||
"열": "t",
|
||||
"서식": [{}],
|
||||
"시트": [{"id": "s1", "이름": "표", "칸": plan["cells"]}],
|
||||
"활성": "s1",
|
||||
}
|
||||
values = recalc_workbooks([book])[0]["s1"]
|
||||
assert values[plan["plan"]["statusCell"]]["글"] == "찾음"
|
||||
assert float(values[plan["plan"]["outCells"]["증가율"]]["수"]) == 72
|
||||
|
||||
|
||||
def test_표_상자에_표_번호가_안_보임_이름으로_보임():
|
||||
info = {**EXACT, "key": "QF000421", "name": "메쌓기(인력)", "no": "13-4-1", "base": "1㎡"}
|
||||
roles = {"cond": list(info["conds"]), "out": ["석공"]}
|
||||
out = run([{"op": "rename", "info": info, "roles": roles}])[0]
|
||||
assert out["sheets"] == ["표 · 메쌓기(인력)", "계산"]
|
||||
assert out["ref"] == "QF000421" # 번호는 상자 ref 에만
|
||||
assert "QF000421" not in " ".join(out["texts"])
|
||||
assert any("13-4-1" in t and "1㎡" in t for t in out["texts"])
|
||||
assert out["refs"]["B2"]["식"] == "'표 · 메쌓기(인력)'!G7*2"
|
||||
assert out["refs"]["B3"]["식"] == "'표 · 메쌓기(인력)'!G7+1"
|
||||
|
||||
Reference in New Issue
Block a user