fix(m02-cf): 함수 상자 출력 기본 이름을 로직 안에서 겹치지 않게

- addBox(function) 출력 이름 = 「결과 1」 「결과 2」 … (안 쓰인 가장 작은 번호) · A1 머리도 같은 이름
- 이름이 겹치면 link 가 받는 알약을 「이름 (2)」 로 만듦(이미 됨 · 시험 더함)
- 시험 14개

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VBToTCGk5dqDKeXCEP3vhk
This commit is contained in:
2026-10-01 16:32:32 +09:00
co-authored by Claude Opus 5.5
parent 306a251712
commit 2be767d186
2 changed files with 33 additions and 3 deletions
+9 -3
View File
@@ -188,13 +188,19 @@ export function addBox(
);
const box: CfBox = { id, kind, name, color: BOX_COLOR[kind], unit: "-", x, y };
if (kind === "input") box.input = { mode: "variable", elements: [], variables: [] };
if (kind === "function")
if (kind === "function") {
// 출력 이름은 로직 안에서 겹치지 않게 「결과 1」 「결과 2」 … — 다른 함수 상자의 받는 알약과 섞이지 않음
const taken = lg.boxes.flatMap((b) => (b.func ? [b.func.output.name] : []));
let n = 1;
while (taken.includes(`${tl("Result")} ${n}`)) n++;
const out = `${tl("Result")} ${n}`;
box.func = {
sheet: { id: `s-${id}`, 이름: name, 칸: { A1: { 값: tl("Result") } } },
sheet: { id: `s-${id}`, 이름: name, 칸: { A1: { 값: out } } },
inputs: [],
variables: [],
output: { cell: "B1", name: tl("Result"), unit: "-" },
output: { cell: "B1", name: out, unit: "-" },
};
}
if (kind === "output") box.output = { cost: "노무비", unit: "-" };
return { lg: { ...lg, boxes: [...lg.boxes, box] }, box };
}