diff --git a/M02_MasterTemplete/M02_MasterTemplete_Hopyo_Sheet.ts b/M02_MasterTemplete/M02_MasterTemplete_Hopyo_Sheet.ts index c0a37d2b5..687db5ab1 100644 --- a/M02_MasterTemplete/M02_MasterTemplete_Hopyo_Sheet.ts +++ b/M02_MasterTemplete/M02_MasterTemplete_Hopyo_Sheet.ts @@ -82,8 +82,20 @@ const won = (v: number | null | undefined): string => v === null || v === undefined ? "" : v.toLocaleString("ko-KR"); const note = (text: string): HTMLElement => el("span", { className: "m02-hopyo__note", text }); -/** 목록 숫자 「연결된 줄 / 연결할 줄」 — 다 연결(같고 0 넘음)이면 참 · 0/0 은 색 없음 */ -export const allLinked = (m: [number, number]): boolean => m[1] > 0 && m[0] === m[1]; +/** 목록 숫자 「연결된 줄 / 연결할 줄」(358-3 두 칸 · 없으면 옛 맞춤 [제안, 줄]) — 다 연결(같고 0 넘음)이면 참 · + * 0/0 은 색 없음 */ +export function allLinked(h: { + 맞춤: [number, number]; + 연결할?: number; + 연결된?: number; +}): boolean { + const [done, all] = h.연결할 === undefined ? h.맞춤 : [h.연결된 ?? 0, h.연결할]; + return all > 0 && done === all; +} + +/** 목록 숫자 글 — 358-3 두 칸이 있으면 그것 */ +const linkText = (h: { 맞춤: [number, number]; 연결할?: number; 연결된?: number }): string => + h.연결할 === undefined ? `${h.맞춤[0]}/${h.맞춤[1]}` : `${h.연결된 ?? 0}/${h.연결할}`; /** 엑셀 행(1부터)이 든 호표 번 · 없으면 null */ export const hopyoAtRow = (list: HopyoSpan[], row: number): number | null => @@ -280,8 +292,8 @@ export function openHopyoSheet(opt: HopyoSheetOptions): void { else checked.delete(h.번); paintGo(); }); - const linked = note(`${h.맞춤[0]}/${h.맞춤[1]}`); - linked.classList.toggle("is-linked", allLinked(h.맞춤)); + const linked = note(linkText(h)); + linked.classList.toggle("is-linked", allLinked(h)); const row = el("div", { className: `m02-hopyo-sheet__item${h.번 === current ? " is-current" : ""}`, attrs: { "data-hopyo-no": String(h.번), title: `${h.이름} ${h.규격}`.trim() }, diff --git a/resources/tester/helper_m02_hopyo_check.cjs b/resources/tester/helper_m02_hopyo_check.cjs index b3d3acdd3..90af13bf0 100644 --- a/resources/tester/helper_m02_hopyo_check.cjs +++ b/resources/tester/helper_m02_hopyo_check.cjs @@ -224,10 +224,13 @@ let out0 = null; { 번: 8, 아래: [7] }, ]), linked: [ - [2, 2], - [1, 2], - [0, 0], - [3, 2], + { 맞춤: [2, 2] }, + { 맞춤: [1, 2] }, + { 맞춤: [0, 0] }, + { 맞춤: [3, 2] }, + { 맞춤: [1, 4], 연결할: 3, 연결된: 3 }, // 358-3 두 칸이 앞섬(% · 노임 줄 밖) + { 맞춤: [3, 3], 연결할: 3, 연결된: 2 }, + { 맞춤: [0, 1], 연결할: 0, 연결된: 0 }, ].map(sheet.allLinked), }, }; diff --git a/resources/tester/test_m02_hopyo_screen.py b/resources/tester/test_m02_hopyo_screen.py index ca7514377..b07eda4c2 100644 --- a/resources/tester/test_m02_hopyo_screen.py +++ b/resources/tester/test_m02_hopyo_screen.py @@ -194,7 +194,8 @@ def test_로직_추가_확인된_것은_바로_참조_아니면_확인_창(): def test_엑셀_보기_창_하위_호표_먼저(): got = _check()["sheet"] assert got["order"] == [46, 45, 3, 7, 8] # 순환은 남은 차례 - assert got["linked"] == [True, False, False, False] # 다 연결만 녹색 · 0/0 색 없음(359-2) + # 다 연결만 녹색 · 0/0 색 없음(359-2) · 358-3 연결할 · 연결된 두 칸이 있으면 그것 + assert got["linked"] == [True, False, False, False, True, False, False] def _pick() -> dict: @@ -299,7 +300,7 @@ def test_옛_즉시_확정과_바로_만들기_없음(): assert '"수정"' in edit and "e.stopPropagation();" in edit and "openHopyoCheck({" in edit row = sheet.split("function paintList(")[1] assert row.index("m02-hopyo-sheet__no") < row.index("editButton(h)") < row.index("__name") - assert 'linked.classList.toggle("is-linked", allLinked(h.맞춤));' in row + assert 'linked.classList.toggle("is-linked", allLinked(h));' in row pick = texts["Hopyo_Pick"] assert "if (row.확인)" in pick and 'import("./M02_MasterTemplete_Hopyo_Check")' in pick assert not (M02 / "M02_MasterTemplete_Hopyo_View.ts").exists() # 본 칸 표 없음(359-1)