diff --git a/A00_Common/formula_doc_copy.ts b/A00_Common/formula_doc_copy.ts index a54103e7e..5670c27e5 100644 --- a/A00_Common/formula_doc_copy.ts +++ b/A00_Common/formula_doc_copy.ts @@ -1,9 +1,9 @@ /* ============================================================================= * formula_doc_copy.ts * 수식 문서 사본 몫(PLAN 802-4b-2 · 요구 655-2 · 656 · 659-3) — M02 단가산출(SK) 수식 탭 머리 배지 - * 층 쓰기 권한 없으면 「읽기만」 배지 · 지운 키(M01 · 내 기계) = 「지워짐 n」(마지막 값 유지) - * (859-2 · 요구 903 ~ 905) 프로젝트 안 [단가 갱신] · [재생성] · 「M01 새 판」 · 「새 값」 · 「사본 없는 줄」 걷음 — - * 프로젝트 사본 = 지정한 때 그대로 · 바꾸려면 다시 지정 + * 층 쓰기 권한 없으면 「읽기만」 배지 + * (859-2 · 요구 903 ~ 905) [단가 갱신] · [재생성] · 「M01 새 판」 · 「새 값」 · 「사본 없는 줄」 · 「지워짐」 걷음 — + * 프로젝트 사본 = 지정한 때 그대로 · 바꾸려면 다시 지정 · M02 층 = 자동 따라옴 · 알림 = 토스트(`formula_doc_renew`) * ========================================================================== */ import { createBadge } from "@ui/ui_template_badge"; @@ -13,16 +13,14 @@ import { swappedCount } from "../common_util/common_util_line_stack_pick"; import { ft } from "./formula_doc_text"; import type { RenewNote } from "./formula_doc_renew"; -/** 사본 표지(서버 `M02_Doc_Copy.state` + 시점 · 따로) */ +/** 사본 표지(서버 `M02_Doc_Sk_Path.answer` · `read`) */ export interface CopyMark { - 지운키?: string[]; - 따로?: boolean; /** 가져온 식(엑셀 불러오기 · 807-1) 단가기준 — 엑셀 = 엑셀 값 기억 · 우리 = 연결 값 */ 단가기준?: Basis; - /** M01 자동 따라옴(836-2 · 프로젝트 층 밖) */ - 자동?: boolean; - /** 열 때 알림(836-2) — M01 에서 바뀐 항목의 지운 고침 */ + /** 열 때 알림(836-2) — M01 에서 바뀐 항목의 내 고침(지킴 · 다시복사 · 지워짐) */ 갱신?: RenewNote[]; + /** 저장 뒤 M01 몫이 바뀌어 따라옴(859-2) — 지문 · 없으면 null */ + 따라옴?: string | null; } export interface CopyOptions { @@ -32,16 +30,8 @@ export interface CopyOptions { onSaved?: (version: string) => void; } -export function copyBadges(m: CopyMark | undefined, edit: boolean): HTMLElement[] { - const out: HTMLElement[] = []; - if (m?.지운키?.length) { - const b = createBadge(`${ft("Gone")} ${m.지운키.length}`, "warning"); - b.title = `${m.지운키.join(" · ")} — ${ft("Gone_Note")}`; - b.dataset.copyGone = m.지운키.join(","); - out.push(b); - } - if (!edit) out.push(createBadge(ft("Read_Only"), "neutral")); - return out; +export function copyBadges(edit: boolean): HTMLElement[] { + return edit ? [] : [createBadge(ft("Read_Only"), "neutral")]; } /** 가져온 식 바꾼 줄 배지(823-1) — 「바꾼 줄 n — 원본과 다름」 · 없으면 없음 */ diff --git a/A00_Common/formula_doc_renew.ts b/A00_Common/formula_doc_renew.ts index 9e5c69181..a5662eb0f 100644 --- a/A00_Common/formula_doc_renew.ts +++ b/A00_Common/formula_doc_renew.ts @@ -1,129 +1,53 @@ /* ============================================================================= * formula_doc_renew.ts - * M01 자동 따라옴 알림(PLAN 836-2 · 요구 854) — M02 단가산출(프로젝트 층 밖)을 열 때 - * M01 에서 바뀐 항목에 얹힌 내 고침을 지우고 다시 복사한 것을 한 번 보임(서버 `M02_Sk_AutoRenew.notes`) - * 표 = 항목 · M01 전 → 후 · 지워진 내 고침 · [확인] = 저장(다시 안 뜸) · [나중에] = 다음에 열면 또 뜸 - * 고침 없는 항목은 조용히 따라옴(알림 없음) - * 848-3(요구 889 · 이음 848-2) — 처리 「지킴」 줄 = 따로 표: 항목 · 위 값 전 → 후 · 내 값(지킴) · [위 값으로] - * [위 값으로] = 그 칸의 내 고침을 지움(부르는 쪽 `back` · 캐시 → [저장]) · 「다시복사」 · 「지워짐」 · 옛 꼴 = 위 표 그대로 + * M01 자동 따라옴 알림(PLAN 836-2 · 859-2 · 요구 904) — M02 단가산출(프로젝트 층 밖)을 열 때 토스트 한 번 · 확인 단추 없음 + * 서버 읽기 답 `사본.따라옴`(저장 뒤 M01 몫이 바뀌어 따라온 지문 · 없으면 null) · `사본.갱신`(`M02_Sk_AutoRenew.notes` — + * 처리 = 지킴(내가 고친 칸 = 내 값) · 다시복사 · 지워짐(다시 못 얹은 내 고침)) + * 같은 바뀜 = 이 브라우저에서 한 번만(localStorage · SK 길마다 따라옴 지문 · 알림 글) · 칸 풍선글(원래 값 · 기초에서 바뀜)은 줄 쌓기 그대로 * ========================================================================== */ -import { askConfirm, createButton, el } from "@ui/ui_template_elements"; -import { eqText } from "@ui/ui_template_equation"; -import { createTable } from "@ui/ui_template_table"; +import { showToast } from "@ui/ui_template_elements"; import { ft } from "./formula_doc_text"; -/** 서버 알림 한 줄 — 갈래 = 문서(바탕 수식) · 부름(굳힌 부른 문서) · 기계(기계 덮음) */ +/** 서버 알림 한 줄 — 토스트는 처리 갈래 수만 셈 */ export interface RenewNote { 키: string; - 이름?: string; - 갈래?: string; - M01?: string[]; - 내고침?: string[]; - /** 848-2 — 지킴 · 다시복사 · 지워짐(없음 = 옛 꼴) */ 처리?: string; - /** 지킴 — 기계덮음 열쇠 · 칸 경로(`값.<칸>` · 조종원 · 잡품 · `작업량.*`) · 보일 이름 · 위 층 전 · 후 · 내 값 */ - 열쇠?: string; - 경로?: string; - 칸?: string; - 층?: string; - 전?: unknown; - 후?: unknown; - 내값?: unknown; - /** 다시복사 · 지워짐 — 다시 얹은 고침 */ - 다시얹음?: string[]; } -export const KEPT = "지킴"; +const SEEN = "aislo:renew-seen:"; -/** 칸 안 여러 줄 — 줄마다 한 덩이 */ -const lines = (xs: string[] | undefined): HTMLElement => - el("div", { children: (xs ?? []).map((t) => el("div", { text: t })) }); - -/** 값 글 — 수 · 글 · 줄 목록(인력 · 잡품 = 이름 수량) */ -export function noteValue(v: unknown): string { - if (v === undefined || v === null || v === "") return "—"; - if (typeof v === "number") return eqText(v); - if (Array.isArray(v)) - return v - .map((r) => { - if (!r || typeof r !== "object") return String(r); - const x = r as Record; - const qty = x.인 ?? x.수량; - return [x.이름 ?? x.키 ?? x.줄, qty === undefined ? "" : noteValue(qty), x.율 === undefined ? "" : `${noteValue(x.율)}%`] // prettier-ignore - .filter((t) => t !== "" && t !== undefined) - .join(" "); - }) - .join(", "); - return typeof v === "object" ? JSON.stringify(v) : String(v); +/** 토스트 글 — 반영됨 · 내 값 지킨 칸 n · 다시 못 얹은 내 고침 n */ +export function renewText(notes: RenewNote[]): string { + const count = (kind: string): number => notes.filter((n) => n.처리 === kind).length; + const kept = count("지킴"); + const lost = count("지워짐"); + return [ + ft("Renew_Toast"), + ...(kept ? [ft("Renew_Kept_N").replace("{n}", String(kept))] : []), + ...(lost ? [ft("Renew_Lost_N").replace("{n}", String(lost))] : []), + ].join(" · "); } -/** 알림 창 — 확인이면 true(부르는 쪽이 저장) · `back` = 지킴 줄 [위 값으로](누른 줄을 닫을 때 한 번에) */ -export async function askRenew( +/** 열 때 한 번 — 새 따라옴 지문(저장 뒤 M01 몫 바뀜) · 새 알림(내가 고친 칸의 위 값 바뀜)일 때만 · + * [저장] 하면 따라옴 지문 없음 · 지킨 칸 알림은 같은 글이면 다시 안 띄움(저장소가 막히면 열 때마다) */ +export function renewToast( + where: string, + moved: string | null | undefined, notes: RenewNote[], - back?: (picked: RenewNote[]) => void, -): Promise { - const kept = notes.filter((n) => n.처리 === KEPT && n.열쇠 && n.경로); - const rest = notes.filter((n) => !kept.includes(n)); - const picked: RenewNote[] = []; - const parts: HTMLElement[] = []; - if (kept.length) { - const table = createTable( - [ - { label: ft("Renew_Item"), width: "28%" }, - { label: ft("Renew_Upper") }, - { label: ft("Renew_Kept") }, - { label: "", width: "120px" }, - ], - kept.map((n) => { - const b = createButton({ - label: ft("Renew_Back"), - variant: "ghost", - size: 24, - iconStart: "undo", - onClick: () => { - picked.push(n); - b.disabled = true; - b.setAttribute("aria-pressed", "true"); - }, - }); - b.dataset.renewBack = `${n.열쇠}|${n.경로}`; - return [ - lines([n.이름 || n.키, n.칸 || n.경로 || ""]), - `${noteValue(n.전)} → ${noteValue(n.후)}`, - noteValue(n.내값), - ...(back ? [b] : [""]), - ]; - }), - { density: "data" }, - ); - table.dataset.renewKept = String(kept.length); - parts.push(table); +): void { + const text = notes.length ? JSON.stringify(notes) : ""; + let seen: { m?: string; n?: string } = {}; + try { + seen = JSON.parse(localStorage.getItem(SEEN + where) ?? "{}") as typeof seen; + } catch { + /* 저장소 막힘 = 열 때마다 */ } - if (rest.length) { - const table = createTable( - [ - { label: ft("Renew_Item"), width: "28%" }, - { label: ft("Renew_M01") }, - { label: ft("Renew_Mine") }, - ], - rest.map((n) => [ - lines([n.이름 || n.키, n.키]), - lines(n.M01), - lines([...(n.내고침 ?? []), ...(n.다시얹음 ?? []).map((t) => `↻ ${t}`)]), - ]), - { density: "data" }, - ); - table.dataset.renewNotes = String(rest.length); - parts.push(table); + if (!(moved && moved !== seen.m) && !(text && text !== seen.n)) return; + try { + localStorage.setItem(SEEN + where, JSON.stringify({ m: moved || seen.m || "", n: text })); + } catch { + /* 저장소 막힘 */ } - const ok = await askConfirm({ - title: ft("Renew_Title"), - message: ft(kept.length ? "Renew_Ask_Kept" : "Renew_Ask"), - okLabel: ft("Renew_Ok"), - cancelLabel: ft("Renew_Later"), - detail: parts.length === 1 ? parts[0] : el("div", { children: parts }), - }); - if (picked.length) back?.(picked); - return ok; + showToast(renewText(notes), "info"); } diff --git a/A00_Common/formula_doc_text.ts b/A00_Common/formula_doc_text.ts index 83af3e8c0..22efecc39 100644 --- a/A00_Common/formula_doc_text.ts +++ b/A00_Common/formula_doc_text.ts @@ -43,27 +43,11 @@ const TEXT = { Linked: ["연결", "Linked"], Unlink: ["연결 끊기", "Unlink"], Relink: ["다시 잇기", "Relink"], - Gone: ["지워짐", "Deleted"], - Gone_Note: ["마지막 값 유지", "last value kept"], Swapped_N: ["바꾼 줄 {n} — 원본과 다름", "{n} swapped — differs from source"], Job_Done: ["적용함", "Applied"], - Renew_Title: ["M01 이 바뀌어 다시 복사함", "Re-copied from updated M01"], - Renew_Ask: [ - "M01 에서 바뀐 항목에 있던 내 고침을 지우고 M01 에서 다시 복사함 — [확인] 하면 저장(다시 안 뜸)", - "Your edits on items changed in M01 were removed and re-copied — OK saves (no repeat)", - ], - Renew_Ask_Kept: [ - "위 층(M01 · 기초)에서 값이 바뀜 — 내가 고친 칸은 내 값을 지킴 · [위 값으로] = 그 칸이 위 값을 따름([저장] 해야 반영) · [확인] 하면 다시 안 뜸", - "Upper values changed — your edited cells keep your values · [Use upper] follows the upper value (on [Save]) · OK hides this", - ], - Renew_Upper: ["위 값 전 → 후", "Upper before → after"], - Renew_Kept: ["내 값(지킴)", "My value (kept)"], - Renew_Back: ["위 값으로", "Use upper"], - Renew_Item: ["항목", "Item"], - Renew_M01: ["M01 전 → 후", "M01 before → after"], - Renew_Mine: ["지워진 내 고침", "Removed edits"], - Renew_Ok: ["확인", "OK"], - Renew_Later: ["나중에", "Later"], + Renew_Toast: ["M01 기초가 바뀌어 반영됨", "Updated from changed M01 basis"], + Renew_Kept_N: ["내가 고친 칸 {n} 은 내 값 그대로", "{n} edited cell(s) keep your value"], + Renew_Lost_N: ["다시 못 얹은 내 고침 {n}", "{n} edit(s) could not be re-applied"], Basis_Excel: ["엑셀 단가 그대로", "Excel prices"], Basis_Ours: ["우리 단가로", "Our prices"], Dirty_First: [ diff --git a/A00_Common/line_stack_screen.ts b/A00_Common/line_stack_screen.ts index 2ed9e58c2..840573223 100644 --- a/A00_Common/line_stack_screen.ts +++ b/A00_Common/line_stack_screen.ts @@ -54,7 +54,7 @@ import { } from "../common_util/common_util_line_stack"; import { copyBadges, type CopyMark, type CopyOptions, swapBadge } from "./formula_doc_copy"; import { docFoot } from "./formula_doc_foot"; -import { askRenew, type RenewNote } from "./formula_doc_renew"; +import { renewToast } from "./formula_doc_renew"; import { buildOptions, machineText } from "./formula_doc_options"; import { hiddenByWork } from "./formula_doc_render"; import { ft } from "./formula_doc_text"; @@ -64,7 +64,6 @@ import type { Layer } from "../common_util/common_util_m02_call"; import { applyDiff } from "./line_stack_diff"; import { buildEdit } from "./line_stack_edit"; import { openMachineWindow, type CopyAnswer, type MachineCtx } from "./line_stack_machine"; -import { dropPath } from "../common_util/common_util_formula_doc_cover_drop"; import { buildOut } from "./line_stack_out"; import { lt } from "./line_stack_text"; import "./line_stack.css"; @@ -403,7 +402,7 @@ export function createStackScreen(opt: StackScreenOptions) { className: "lstk__badges", children: [ ...(busy ? [createBadge(ft("Dirty"), "warning")] : []), - ...(cp ? copyBadges(mark, opt.admin) : []), + ...(cp ? copyBadges(opt.admin) : []), ...(basis() ? swapBadge(doc) : []), // 823-1 가져온 줄 바꿔 끼움 ], }), @@ -619,14 +618,8 @@ export function createStackScreen(opt: StackScreenOptions) { recalc(); draw(); opt.page?.(); // 캐시에서 이어 받은 고침 — 페이지 [저장] · [되돌림] 켬 - const notes = (mark as CopyMark | undefined)?.갱신; // 836-2 M01 자동 따라옴 알림(take 가 채움) - if (cp && edit() && !dirty() && notes?.length) { - let picked: RenewNote[] = []; // 848-3 [위 값으로] = 확인 저장 뒤 캐시에서 그 칸 고침 지움 → [저장] - void askRenew(notes, (p) => (picked = p)).then(async (ok) => { - if (ok) await save({ 할일: "갱신확인", 판: version }, ""); - if (picked.length) change((d) => picked.forEach((n) => dropPath(d, n.열쇠!, n.경로!))); - }); - } + const m = mark as CopyMark | undefined; // 836-2 · 859-2 M01 자동 따라옴 = 토스트 한 번(take 가 채움) + if (cp) renewToast(cp.route(next, ""), m?.따라옴, m?.갱신 ?? []); } catch (e) { if (mine === seq) failed(e); } diff --git a/M02_MasterTemplete/M02_Doc_Router.py b/M02_MasterTemplete/M02_Doc_Router.py index 43a8b9434..88a5cd1ad 100644 --- a/M02_MasterTemplete/M02_Doc_Router.py +++ b/M02_MasterTemplete/M02_Doc_Router.py @@ -26,7 +26,6 @@ router = APIRouter(prefix="/api/m02", tags=["M02 MasterTemplete Sangeun Doc"]) class DocBody(BaseModel): 문서: dict[str, Any] | None = None 끊음: dict[str, Any] | None = None - 할일: str | None = None 판: str | None = None 단가기준: str | None = None # 가져온 식만(807-1 · 엑셀 | 우리) 본: dict[str, Any] | None = None # 저장 전 SK 문서째(836-5 · 파일 안 읽음 · 안 씀) diff --git a/M02_MasterTemplete/M02_Doc_Sk.py b/M02_MasterTemplete/M02_Doc_Sk.py index e2efd8069..689f387dd 100644 --- a/M02_MasterTemplete/M02_Doc_Sk.py +++ b/M02_MasterTemplete/M02_Doc_Sk.py @@ -295,7 +295,7 @@ def settle(out: dict, whole: Any, job: Any, raw: Any) -> dict: file = stored(out.get("키")) or {} have = file.get(KEY) if dc.has(file) else (raw.get(KEY) if dc.has(raw) else None) have = ( - upper(out, renew.form(out, have, confirm=job == renew.CONFIRM)) if have else have + upper(out, renew.form(out, have)) if have else have ) # 836-2 · ① 위 층 덮음(848-1) — 저장 때 굳음 if have and have.get("따로") and job != skc.REGEN: if file and old_fp(file) != old_fp(out): diff --git a/M02_MasterTemplete/M02_Doc_Sk_Path.py b/M02_MasterTemplete/M02_Doc_Sk_Path.py index 7b9033b9b..f49fa3e0e 100644 --- a/M02_MasterTemplete/M02_Doc_Sk_Path.py +++ b/M02_MasterTemplete/M02_Doc_Sk_Path.py @@ -2,10 +2,11 @@ M01 수식 문서 길과 같은 꼴: 읽기 {문서, 셈} · 미리 셈 {문서} → {셈} · 저장 {문서} → {문서, 셈}. 몸 칸 — `문서`(이 SK 수식 문서 · 키 = SK 키) · `끊음` {키: 문서}(이 사본에 굳힌 부름 · 고칠 수 있음 · - 없는 키 = 다시 이음) · `할일` 갱신확인(알림 확인 저장) · `판`(저장 · 그 SK 파일 판). + 없는 키 = 다시 이음) · `판`(저장 · 그 SK 파일 판). 셈 = 서버 정본(`M02_Doc_Copy.run`) — 화면이 보낸 값 · 사본은 안 받음(문서 · 끊음 글만). 저장 = 그 SK 저장(`store.write` — 층 쓰기 권한 · 판 409 · 옛 칸 · 로직 사본 그대로) · - 문서 고침 = 따로(이 문서가 정본) · 859-2 [단가 갱신] · [재생성] 할일 걷음(받으면 400). + 문서 고침 = 따로(이 문서가 정본) · 859-2 할일(단가갱신 · 재생성 · 갱신확인) 걷음. +읽기 답 `사본.따라옴`(859-2) = 저장 뒤 M01 몫이 바뀌어 따라옴 지문(화면 토스트 한 번) · 같으면 null. 가져온 식 SK(807-1) = 가져온 줄 문서 · 셈 = 단가기준(엑셀 값 · 연결 값) · 부름 · 끊음 없음 (형제 SK 는 셈 때 읽음) · 바탕 참조 SK = 값 사본 없음(400). 저장 전 문서(836-5 · 불러오기 미리 보기 835-1) = 몸 `본`(그 SK 문서째) — 파일 안 읽음 · 안 씀 · 읽기 · 미리 셈만(`read_memory`). @@ -33,7 +34,6 @@ from M02_MasterTemplete import M02_Sk_AutoRenew as renew import master_doc_cover as mcv # noqa: E402 — 기계 덮음(836-1 · scripts 길 = dc) MAX = 2_000_000 # 문서 글 크기(바이트) 상한 -JOBS = (renew.CONFIRM,) # 859-2 단가갱신 · 재생성 걷음 def _bad(why: str, status: int = 400) -> store.StoreError: @@ -46,13 +46,6 @@ def _file(key: str) -> dict[str, Any]: return store.read(sd.KIND, key) -def _job(body: dict) -> Any: - job = body.get("할일") or None - if job not in (None, *JOBS): - raise _bad("할일은 갱신확인") - return job - - def _settled(doc: dict) -> tuple[dict, Any]: """옛 셈 길 첫머리(`calc_doc`)와 같게 — (정리한 문서, 사본 색인).""" from M02_MasterTemplete import M02_Sangeun_Calc as calc @@ -85,8 +78,9 @@ def answer(copy: dict, sk: dict) -> dict[str, Any]: """{문서, 부름, 끊음, 셈, 사본 표지, 연결 기록} — 글 · 수는 JSON 꼴 · 가져온 식 표지 = 단가기준.""" got = dsk.run(sk, copy) head = {k: copy.get(k) for k in ("시점", "단가시점")} - mark = {**head, "따로": bool(copy.get("따로")), "자동": renew.on()} # 836-2 M01 자동 따라옴 - mark |= {"단가기준": dim.basis_of(sk)} if dim.is_imported(sk) else dc.state(copy) + mark = {**head, "따로": bool(copy.get("따로"))} + if dim.is_imported(sk): + mark["단가기준"] = dim.basis_of(sk) body = { "문서": copy["문서"], "위덮음": copy.get(dsk.UPPER) or {}, @@ -129,7 +123,8 @@ def read(key: str) -> dict[str, Any]: got = _file(key) copy = current(got["문서"]) out = {**answer(copy, got["문서"]), "판": got["판"], "층바탕": layers(copy, got["문서"])} - out["사본"]["갱신"] = renew.notes(got["문서"]) # 836-2 열 때 알림(지울 고침) + out["사본"]["갱신"] = renew.notes(got["문서"]) # 836-2 열 때 알림(지킨 칸 · 지울 고침) + out["사본"]["따라옴"] = renew.followed(got["문서"], copy) # 859-2 열 때 토스트 한 번 return out @@ -213,7 +208,6 @@ def _preview(key: str, body: dict) -> dict[str, Any]: else: doc = _file(key)["문서"] mine = _basis(doc, body) - _job(body) before = current(doc) out = answer(edited(before, body, key, doc), mine) out |= {"전": dc.money(dsk.run(doc, before)), "후": dc.money(out["셈"])} @@ -278,8 +272,7 @@ def machine(key: str, no: str) -> dict[str, Any]: def _save(key: str, body: dict, got: dict) -> dict[str, Any]: - job = _job(body) - raw = {**_basis(got["문서"], body), **({skc.JOB: job} if job else {})} + raw = _basis(got["문서"], body) token = None if body.get("문서") is not None or body.get("끊음") is not None: mine = plain(edited(current(got["문서"]), body, key, got["문서"]), got["문서"]) diff --git a/M02_MasterTemplete/M02_MasterTemplete_Sangeun_Detail.ts b/M02_MasterTemplete/M02_MasterTemplete_Sangeun_Detail.ts index 1e40a9408..40674670e 100644 --- a/M02_MasterTemplete/M02_MasterTemplete_Sangeun_Detail.ts +++ b/M02_MasterTemplete/M02_MasterTemplete_Sangeun_Detail.ts @@ -5,11 +5,10 @@ * 수식 먼저 → 판 · 수식 칸 새로) · ref(저장한 SK — 줄 쌓기 자기 저장 · 불러오기 저장 뒤) · memory(저장 전 가져온 식 · 보기만) * 머리 띠(856-2) = 줄 쌓기 셈 답 · 문서 읽기 사본 표지(`onAnswer` · 서버 셈 길 안 부름) — * 까닭(빨강) = 못 읽음 · 못 셈(서버 `M02_Sangeun_Calc.run` 「까닭」 과 같은 차례) · 빠진 줄 = 금액 없는 줄 까닭 · - * M01 개정 = 자동 따라옴 알림(`갱신`) + * M01 개정 알림 = 줄 쌓기가 토스트 한 번(859-2 · 머리 띠 · 배지 없음) * 옛 상세 몸(덮개 · 뺀줄 · 더한줄 · 재료 고름 · 줄 모달)은 856-1 에 걷음 — 고침은 줄 쌓기 한 벌 * ========================================================================== */ -import { createBadge } from "@ui/ui_template_badge"; import { createBanner } from "@ui/ui_template_banner"; import { el } from "@ui/ui_template_elements"; import { createInputField } from "@ui/ui_template_input"; @@ -54,14 +53,12 @@ export interface SangeunDetailOptions { const LIB = { read: "/m02/logic-lib", calc: "/m02/logic-lib" }; const clone = (v: T): T => JSON.parse(JSON.stringify(v)) as T; -/** 머리 띠 재료(856-2) — 못 셈 까닭 · 금액 없는 줄 · M01 개정 */ +/** 머리 띠 재료(856-2) — 못 셈 까닭 · 금액 없는 줄 */ export function bandsOf(got: StackAnswer | null): { why: string; gaps: { 이름: string; 까닭: string }[]; - revised: boolean; } { const a = got?.answer; - const m = got?.mark; const marks = (a?.표지 ?? []).map((x) => `${x.갈래} — ${x.글}`).join(" · "); const why = got?.fail || @@ -75,8 +72,7 @@ export function bandsOf(got: StackAnswer | null): { const gaps = (a?.셈됨 ? (a.줄 ?? []) : []) .filter((r) => r.까닭 && r.금액 == null) .map((r) => ({ 이름: String(r.이름 ?? ""), 까닭: String(r.까닭) })); - const revised = !!m?.갱신?.length; - return { why, gaps, revised }; + return { why, gaps }; } export function mountSangeunDetail( @@ -103,7 +99,6 @@ export function mountSangeunDetail( const head = el("div", { className: "m02-sk__head", attrs: { "data-sk-head": "" } }); const notes = el("div"); - const flag = el("span"); // M01 개정 배지 자리(856-2 — 줄 쌓기가 그릴 때마다 머리 칸은 그대로) let refreshing: Promise = Promise.resolve(); const tabs = createSangeunTabs({ edit, @@ -201,16 +196,15 @@ export function mountSangeunDetail( el("div", { className: "m02-sk__tags", attrs: { "data-sk-base": baseKey() ?? "" }, - children: [createText(`${L("M02_SangeunBase")} · ${baseText}`, "muted", 14), flag], + children: [createText(`${L("M02_SangeunBase")} · ${baseText}`, "muted", 14)], }), ); } function drawNotes(): void { - const { why, gaps, revised } = bandsOf(got); + const { why, gaps } = bandsOf(got); notes.replaceChildren( ...(fail || why ? [createBanner({ tone: "danger", text: fail || why })] : []), - ...(revised ? [createBanner({ tone: "warning", text: L("M02_SangeunRevisedNote") })] : []), ...(gaps.length ? [ createBanner({ @@ -221,7 +215,6 @@ export function mountSangeunDetail( ] : []), ); - flag.replaceChildren(...(revised ? [createBadge(L("M02_SangeunRevisedBase"), "danger")] : [])); } function draw(): void { diff --git a/M02_MasterTemplete/M02_Sk_AutoRenew.py b/M02_MasterTemplete/M02_Sk_AutoRenew.py index c0057bcb5..3d26d2fc0 100644 --- a/M02_MasterTemplete/M02_Sk_AutoRenew.py +++ b/M02_MasterTemplete/M02_Sk_AutoRenew.py @@ -3,12 +3,13 @@ 프로젝트 층 밖 SK(마스터 · 회사 · 개인) = 셈 · 열기 · 목록 · 일위대가 펼침이 모두 사본 줄 = 지금 M01(+ 층 내 기계) 줄(`rows` · 지운 키 = 값 사본 마지막 줄 — 층 파일 = `수식` 값 몫 한 벌 · 855 2-D) · 부름 문서 = 지금 M01 수식 문서(`form`)로 봄 — 묻지 않음 · [단가 갱신] · [재생성] 없음. -파일(작업본)은 [저장] · 알림 [확인](= 저장 · `confirm`) 때만 새 것으로 씀 — 읽기 길은 안 씀. +파일(작업본)은 [저장] 때만 새 것으로 씀 — 읽기 길은 안 씀 · 열 때 알림 = 화면 토스트 한 번(859-2 · + `followed` 지문 · 확인 단추 없음). 판정 = 칸 단위(848-2): 기계 고침(② `문서.기계덮음`) — 칸마다 「위 값」(① `위덮음` 그 칸 › ⓪ 기계 줄 그 칸) 바탕 대 지금 · 위가 바뀐 칸에 ② 가 있으면 ② 지킴 + 알림(처리 「지킴」) · ② 없는 칸 = 조용히 따라옴(셈이 지금 줄 · 지금 ① 을 읽음) · 기계 줄 글 = 칸 아님. - 바탕 = `덮음바탕`(지킨 칸만 · 알림 [확인] 까지) › 저장 사본 기계 줄 · 저장 `위덮음` · + 바탕 = `덮음바탕`(지킨 칸만) › 저장 사본 기계 줄 · 저장 `위덮음` · 둘 다 없음(고르지 않아 사본 줄 없는 기계) = 바탕 모름 → 알림 없음 · ② 그대로 (다음 저장 때 지금 값이 바탕). 문서(따로 문서 · 끊음) — 계산 내용(`dc.doc_fp`)이 바뀐 것만 다시 복사 · 고쳐 둔 문서 = @@ -17,7 +18,7 @@ M01 [전 → 후 글], 내고침 [글]} + 지킴 = {문서, 열쇠, 경로, 칸, 층(기계 · 기초), 전, 후, 내값} · 다시복사 · 지워짐 = {다시얹음 [글]}. 가져온 식 SK = 값 줄만 따라옴(가져온 줄 문서 · 식 그대로) · 기계 고침 판정 같음(① = 저장 `위덮음`). -프로젝트 층 · B09 사본 = 그대로(사용자가 고르는 [단가 갱신] · [재생성]). +프로젝트 층 · B09 사본 = 그대로(바꾸려면 다시 지정 · 859-2). """ from __future__ import annotations @@ -42,9 +43,8 @@ FIRST = "처음" # `수식` 칸 — 따로가 된 때의 문서(고침 판정 OPTS = ( "맡긴값" # `수식` 칸 — 다시 복사한 따로 문서의 옵션 값 {변수 열쇠: 값}(파생 문서에 다시 얹음) ) -BASE = "덮음바탕" # `수식` 칸 — 지킨 ② 칸의 바탕 {열쇠: {경로: 위 값}} · 알림 [확인] 때 걷음 +BASE = "덮음바탕" # `수식` 칸 — 지킨 ② 칸 바탕 {열쇠: {경로: 위 값}} · 같아지면 빠짐 KEEP = (COVER, OPTS, BASE) # 파생 저장 때 `수식` 에 이어 실을 칸(`M02_Doc_Sk.settle`) -CONFIRM = "갱신확인" # 알림 [확인] 저장 할일 PICK = ("선택", "입력") # 옵션 변수 갈래 MAX_LINES = 8 _MEMO: dict[tuple, dict] = {} @@ -57,7 +57,7 @@ FROZEN = "굳힘" # `수식` 표지 — 사본(구조물 · B09 서고 · 프 def frozen(copy: Any) -> bool: """굳은 사본의 수식 — 위덮음 · 문서 · 값을 실린 그대로 셈(자동 따라옴 안 함 · 855 2-D · - 사용자 원칙: 프로젝트는 M02 것을 복사해 가져감 · [재생성] · [단가 갱신] 전까지 그대로).""" + 사용자 원칙: 프로젝트는 M02 것을 복사해 가져감 · 다시 지정 전까지 그대로).""" return isinstance(copy, dict) and copy.get(FROZEN) is True @@ -209,28 +209,26 @@ def _relabel(mine: dict, first: dict, live: dict) -> None: old.update(fresh) -def _soft(mine: dict, first: dict, live: dict, held: set, opts: bool, confirm: bool): +def _soft(mine: dict, first: dict, live: dict, held: set, opts: bool): """따로 문서 — 위 기초가 옵션 기본 · 글만 바꿈(848-10) → (새 문서, 새 원본, 지킨 옵션 [(열쇠, 전, 후, 내값)]) · 계산 구조가 바뀜 = None(다시 복사). - 옵션: 안 고른 열쇠 = 새 기본 따라옴(원본도) · 고른 열쇠 = 내 값 지킴 + 알림(원본 그대로 = - [확인] 까지 · 옛 칸 `입력값` 고름 = 알림 없이 지킴) · 글: 안 고친 줄만 새 글 · + 옵션: 안 고른 열쇠 = 새 기본 따라옴(원본도) · 고른 열쇠 = 내 값 지킴 + 알림(원본 그대로 · + 옛 칸 `입력값` 고름 = 알림 없이 지킴) · 글: 안 고친 줄만 새 글 · `opts` 거짓 = 계산 내용 그대로(글만 봄).""" was, have, now = _opts(first), _opts(mine), _opts(live) if opts and dc.doc_fp(put_opts(live, was)) != dc.doc_fp(first): return None mine, first = cp.deepcopy(mine), cp.deepcopy(first) _relabel(mine, first, live) - follow, kept, ack = {}, [], {} + follow, kept = {}, [] for k, v in now.items() if opts else (): if k not in was or mcv._canon(v) == mcv._canon(was[k]): continue if k in held or (k in have and mcv._canon(have[k]) != mcv._canon(was[k])): kept += [] if k in held else [(k, was[k], v, have.get(k))] - ack[k] = v else: follow[k] = v - mine, first = put_opts(mine, follow), put_opts(first, {**follow, **(ack if confirm else {})}) - return mine, first, [] if confirm else kept + return put_opts(mine, follow), put_opts(first, follow), kept def _opt_note(key: str, doc: dict, kept: list) -> dict: @@ -241,14 +239,14 @@ def _opt_note(key: str, doc: dict, kept: list) -> dict: } # fmt: skip -def form(sk: Any, got: Any, notes: list | None = None, confirm: bool = False) -> Any: +def form(sk: Any, got: Any, notes: list | None = None) -> Any: """수식 사본 → 지금 M01 으로 본 것(값 줄 · 부름) · 기계 고침 = 칸 단위 지킴(`_covers`) · 계산 내용이 바뀐 고친 문서(끊음 · 따로) = 다시 복사(옵션 값 · ② 다시 얹음) · - 프로젝트 층 = 그대로 · `confirm` = 알림 [확인] 저장(바탕 걷음).""" + 프로젝트 층 = 그대로.""" if not isinstance(got, dict) or not on() or not is_sk(sk) or frozen(got): return got out = rows(got) if "로직" in got else dict(got) - out = _covers(sk, got, out, notes, confirm) + out = _covers(sk, got, out, notes) if imp.is_imported(sk): return out # 가져온 식 = 값만(식 · 가져온 줄 그대로) live = dc.folder() @@ -265,7 +263,7 @@ def form(sk: Any, got: Any, notes: list | None = None, confirm: bool = False) -> if k in redo and dc.doc_fp(cut[k]) == dc.doc_fp(was): cut.pop(k) continue # 안 고친 끊음 = 조용히 따라옴 - soft = _soft(cut[k], was, live[k], set(), k in redo, False) if was else None + soft = _soft(cut[k], was, live[k], set(), k in redo) if was else None if soft is not None: # 옵션 기본 · 글만 바뀜 = 끊음 지킴 · 고른 옵션 알림(848-10) cut[k] = soft[0] if soft[2] and notes is not None: @@ -285,11 +283,11 @@ def form(sk: Any, got: Any, notes: list | None = None, confirm: bool = False) -> moved_doc = out.get("따로") and key in live and not dc.same_origin(base, live[key]) if out.get("따로") and key in live and out.get(FIRST) is not None: held = set((sk.get("입력값") or {}) if isinstance(sk.get("입력값"), dict) else ()) - soft = _soft(out["문서"], out[FIRST], live[key], held, bool(moved_doc), confirm) + soft = _soft(out["문서"], out[FIRST], live[key], held, bool(moved_doc)) if soft is not None: # 옵션 기본 · 글만 바뀜 = 다시 복사 없이 얹음(848-10) mine, first, kept = soft out |= {"문서": mine, FIRST: first} - if moved_doc and (confirm or not kept): + if moved_doc and not kept: out["원본"] = {**base, "판": dc.doc_fp(live[key])} if kept and notes is not None: notes.append(_opt_note(key, mine, kept)) @@ -398,14 +396,13 @@ def _same(a: Any, b: Any) -> bool: return mcv._canon(a) == mcv._canon(b) -def _covers(sk: dict, got: dict, out: dict, notes: list | None, confirm: bool) -> dict: - """② 칸마다 위 값 바탕 대 지금 — 바뀐 칸 = ② 지킴 + 알림 · 바탕(`덮음바탕`)은 지킨 칸만 남김 · - `confirm` = 바탕 걷음(알림 없음).""" +def _covers(sk: dict, got: dict, out: dict, notes: list | None) -> dict: + """② 칸마다 위 값 바탕 대 지금 — 바뀐 칸 = ② 지킴 + 알림 · 바탕(`덮음바탕`)은 지킨 칸만 남김.""" doc = out.get("문서") if isinstance(out.get("문서"), dict) else None cover = mcv.cover_of(doc) if doc is not None else out.get(COVER) or {} - held: dict = {} if confirm else got.get(BASE) or {} + held: dict = got.get(BASE) or {} keep: dict = {} - if cover and not confirm: + if cover: was, here = _eq_rows(got), _eq_rows(out) up0, up1 = got.get(UPPER) or {}, _upper_now(sk, got) for text, mine in cover.items(): @@ -480,6 +477,32 @@ def _note(key, was, now, lost, kind, name=None, again=()) -> dict: } +def followed(sk: Any, now: Any) -> str | None: + """열 때 토스트(859-2) — 저장본 대 지금 셈 사본의 M01 몫(값 줄 판 · 저장본이 부른 문서 · 바탕 문서 판 · + 이 문서 계산 내용)이 다르면 지금 지문 · 같으면 None · 프로젝트 층 · 굳은 사본 = None.""" + if not on() or not is_sk(sk) or not dc.has(sk) or not isinstance(now, dict): + return None + was = sk[dc.KEY] + if not isinstance(was, dict) or frozen(was): + return None + + def part(copy: dict) -> dict: + calls = copy.get("부름") or {} + return { + "값": [copy.get("판"), copy.get("단가판")] + if was.get("판") or was.get("단가판") + else None, + "부름": {k: dc.fp(calls.get(k)) for k in sorted(was.get("부름") or {})}, + "원본": (copy.get("원본") or {}).get("판") + if (was.get("원본") or {}).get("판") + else None, + "문서": dc.doc_fp(copy.get("문서")) if isinstance(was.get("문서"), dict) else None, + } + + got = part(now) + return None if part(was) == got else dc.fp(got) + + def notes(sk: Any) -> list[dict]: """열 때 알림 — 이 SK 저장본의 지킨 칸 · 다시 복사 · 지울 고침(없으면 []) · 프로젝트 층 = [].""" if not is_sk(sk) or not dc.has(sk): diff --git a/resources/tester/test_802_4a_m02_doc.py b/resources/tester/test_802_4a_m02_doc.py index a53f67079..899a06d19 100644 --- a/resources/tester/test_802_4a_m02_doc.py +++ b/resources/tester/test_802_4a_m02_doc.py @@ -201,7 +201,7 @@ def test_delete_tolerant_and_blank(world): lost["금액"].append({"이름": "없는 기초", "비목": "묶음", "단가": "b"}) pre = _at(me, path.preview, key, {"문서": lost}) assert any(m["갈래"] == "연결 끊김" for m in pre["셈"]["표지"]) - for bad in ({"문서": "글"}, {"문서": {"금액": "x"}}, {"끊음": []}, {"할일": "몰라"}): + for bad in ({"문서": "글"}, {"문서": {"금액": "x"}}, {"끊음": []}): # 859-2 할일 칸 걷음 with pytest.raises(store.StoreError) as e: _at(me, path.preview, key, bad) assert e.value.status == 400 diff --git a/resources/tester/test_821_3_my_machine_screen.py b/resources/tester/test_821_3_my_machine_screen.py index 09213a93d..d66a98849 100644 --- a/resources/tester/test_821_3_my_machine_screen.py +++ b/resources/tester/test_821_3_my_machine_screen.py @@ -133,8 +133,8 @@ def test_stack_line_copy(world): copy = _at(me, lambda: store.read("sangeun", sk)["문서"]["수식"]) assert key in [r["키"] for r in copy["단가"]] # 값 사본에 박힘 _at(me, mym.update, key, {**made["줄"], "값": {**made["줄"]["값"], "가격": 3000}}) - now = _at(me, path.read, sk) # 836-2 프로젝트 밖 SK = 자동 따라옴(새 값 배지 없음) - assert now["셈"]["계"] > was and now["사본"]["자동"] and not now["사본"]["단가새값"] + now = _at(me, path.read, sk) # 836-2 프로젝트 밖 SK = 자동 따라옴(859-2 토스트 지문) + assert now["셈"]["계"] > was and now["사본"]["따라옴"] _at(me, mym.delete, key) gone = _at(me, path.read, sk) assert gone["셈"]["계"] == now["셈"]["계"] # 지운 키 = 지우기 직전 따라온 값(요구 902) diff --git a/resources/tester/test_822_1_copy_gap.py b/resources/tester/test_822_1_copy_gap.py index 9df51b0da..6646e4d9c 100644 --- a/resources/tester/test_822_1_copy_gap.py +++ b/resources/tester/test_822_1_copy_gap.py @@ -1,6 +1,6 @@ # ruff: noqa: F811 — 임시 층 fixture(world)를 test_m02_labor_ref 에서 받아 씀 """822-1 사본 빈틈 막기(요구 797-1) — 길마다: 만들기 → [저장] → M01 값(임시 · 메모리 덮개)을 -기계 가격 · 노임 · 유가 · 자재 값으로 바꿈 → 금액 그대로 + 「단가새값」(859-2 [단가 갱신] 걷음). +기계 가격 · 노임 · 유가 · 자재 값으로 바꿈 → 금액 그대로(859-2 [단가 갱신] · 바뀜 표지 걷음). 길 = 수식 길 줄 쌓기(품셈 기계 · 바꿔 끼운 기계 · 자원 줄 · 단가산출 참조) · 옛 로직 길(더한줄 로직 · 재료 · 인력) · 가져온 식(단가기준 우리) · 층 복사 · @@ -109,7 +109,7 @@ def _fuel_and_crew(no: str = DIG_NO) -> tuple[str, str]: @pytest.mark.parametrize("what", ["가격", "유가", "노임"]) def test_stack_m01_machine(world, monkeypatch, what): """품셈 기계(굴착기 1.0㎥) 줄 쌓기 → 저장 → 기계 가격 · 유가 · 조종원 노임 바뀜 → - 금액 그대로 + 단가새값.""" + 금액 그대로.""" me = world["personal"] key = _sk(me) _stack(me, key, [("기계", MACHINE, "묶음")]) @@ -119,7 +119,7 @@ def test_stack_m01_machine(world, monkeypatch, what): moved = {"가격": DIG, "유가": fuel, "노임": crew}[what] _move(monkeypatch, moved) now = _at(me, path.read, key) - assert now["셈"]["계"] == was and now["사본"]["단가새값"] is True + assert now["셈"]["계"] == was def test_stack_swapped_machine(world, monkeypatch): @@ -207,7 +207,6 @@ def test_layer_copy_keeps_copy(world, monkeypatch): doc = refs.read_ref(ref) new = refs.create("sangeun", refs.carry(refs.origin_mark(doc, ref), ("personal", "7/42"))) assert _sum(co, new["이름"]) == was - assert _at(co, path.read, new["이름"])["사본"]["단가새값"] is True def test_gap_mark_then_save_fills(world, monkeypatch): diff --git a/resources/tester/test_826_3_copy_slim.py b/resources/tester/test_826_3_copy_slim.py index 9d60c98ae..c16e11b64 100644 --- a/resources/tester/test_826_3_copy_slim.py +++ b/resources/tester/test_826_3_copy_slim.py @@ -83,7 +83,7 @@ def test_base_logic_read_rows_only(world): def test_m01_change_kept(world, monkeypatch): - """만든 뒤 M01(기계 · 유가 · 노임) 바뀜 → 금액 그대로 + 단가새값 · 사본 줄 그대로.""" + """만든 뒤 M01(기계 · 유가 · 노임) 바뀜 → 금액 그대로 · 사본 줄 그대로.""" me = world["personal"] key = _sk(me, 바탕={"로직": DIG_BASE}, 단위="㎥") was = _sum(me, key) @@ -92,7 +92,6 @@ def test_m01_change_kept(world, monkeypatch): assert moved _move(monkeypatch, *moved) assert _sum(me, key) == was - assert _at(me, path.read, key)["사본"]["단가새값"] is True assert set(_keys(skc.held(_file(me, key)))) == read diff --git a/resources/tester/test_827_1_machine_window.py b/resources/tester/test_827_1_machine_window.py index d5e8824fd..f18a69559 100644 --- a/resources/tester/test_827_1_machine_window.py +++ b/resources/tester/test_827_1_machine_window.py @@ -104,7 +104,7 @@ def test_save_creates_links_and_stamps(world): assert "EQP초안" not in text and draft.FIELD not in saved["문서"] assert f"'개인 {key}'" in text assert key in [r["키"] for r in saved["단가"]] # 사본에 박힘 - assert after["셈"]["계"] == look["셈"]["계"] and after["사본"]["단가새값"] is False + assert after["셈"]["계"] == look["셈"]["계"] assert _at(me, library_uses.machines)[key] == [{"키": sk, "이름": "sub1임시"}] @@ -177,10 +177,10 @@ def test_edit_mine_other_sk_new_value(world): assert look["셈"]["계"] > was assert _at(me, mym.rows)[0]["값"]["가격"] == 1000 # 미리 셈 = 원본 그대로 after = _save(me, second, doc) - assert after["셈"]["계"] == look["셈"]["계"] and after["사본"]["단가새값"] is False + assert after["셈"]["계"] == look["셈"]["계"] assert _at(me, mym.rows)[0]["값"]["가격"] == 5000 and len(_at(me, mym.rows)) == 1 now = _at(me, path.read, first) - assert now["셈"]["계"] == was and now["사본"]["단가새값"] is True + assert now["셈"]["계"] == was seen = _at(me, path.machine, first, f"'{no}'") assert ( seen["사본"]["값"]["가격"] == 1000 and seen["지금"]["값"]["가격"] == 5000 and seen["새값"] diff --git a/resources/tester/test_836_2_sk_auto_renew.py b/resources/tester/test_836_2_sk_auto_renew.py index 6b449acb9..cb2aaef86 100644 --- a/resources/tester/test_836_2_sk_auto_renew.py +++ b/resources/tester/test_836_2_sk_auto_renew.py @@ -4,7 +4,8 @@ ㉠ 노임 · 재료 · 기계 값 바뀜 = 누르지 않고 새 금액(수식 길 열기 · 옛 셈 길 목록 · 일위대가 펼침 같은 답) ㉡ 부른 M01 수식 문서 바뀜 = 따라옴 ㉢ 고친 문서 + 그 문서 M01 바뀜 = 다시 복사 + 알림(전 · 후 · 내 고침) ㉣ 고침 + 다른 항목만 바뀜 = 고침 그대로 ㉤ 바꿨다 되돌림 = 안 고침(알림 없음) -㉥ 프로젝트 층 = 그대로 ㉦ 가져온 식(우리) = 값만 · 식 그대로 · 열기 = 파일 안 고침 · 알림 [확인] = 저장. +㉥ 프로젝트 층 = 그대로 ㉦ 가져온 식(우리) = 값만 · 식 그대로 · 열기 = 파일 안 고침 +㉧ 열 때 토스트 지문(859-2 `따라옴`) = 저장 뒤 M01 몫이 바뀌면 · 같은 바뀜 같은 지문 · [저장] 뒤 없음. """ from __future__ import annotations @@ -96,8 +97,7 @@ def test_values_follow(world, monkeypatch, what): _move(monkeypatch, res) got = _at(me, path.read, key) assert got["셈"]["계"] > was - assert got["사본"]["자동"] is True and got["사본"]["갱신"] == [] - assert not got["사본"]["단가새값"] and not got["사본"]["M01새판"] + assert got["사본"]["갱신"] == [] and got["사본"]["따라옴"] unit = _list_unit(me, key) assert unit["계"] == pytest.approx(got["셈"]["계"]) assert _labor_unit(me, key) == pytest.approx(got["셈"]["계"]) @@ -118,12 +118,12 @@ def test_logic_follows(world, monkeypatch): _doc_move(monkeypatch, MACHINE["키"], twice) got = _at(me, path.read, key) assert got["셈"]["계"] > was * 1.5 # 율 줄은 누계를 받아 두 배 넘음 - assert got["사본"]["갱신"] == [] and not got["사본"]["문서새판"] + assert got["사본"]["갱신"] == [] and got["사본"]["따라옴"] def test_edited_item_recopied(world, monkeypatch): """㉢ 고친 문서 + 그 M01 문서 바뀜 = 고침 지우고 다시 복사 + 알림(전 · 후 · 내 고침) · - [확인](저장) 뒤 알림 없음 · 따로 아님.""" + [저장] 뒤 알림 없음 · 따로 아님(859-2 [확인] 단추 걷음).""" me = world["personal"] key = _base(me) plain = _sum(me, key) @@ -138,7 +138,7 @@ def test_edited_item_recopied(world, monkeypatch): assert note["키"] == PCT and note["갈래"] == "문서" assert any("3%" in x and "4%" in x for x in note["M01"]) assert any("3%" in x and "5%" in x for x in note["내고침"]) - _at(me, path.save, key, {"할일": "갱신확인", "판": got["판"]}) + _at(me, path.save, key, {"판": got["판"]}) after = _at(me, path.read, key) assert after["사본"]["갱신"] == [] and after["사본"]["따로"] is False assert after["셈"]["계"] == got["셈"]["계"] @@ -183,7 +183,7 @@ def test_project_layer_keeps(world, monkeypatch, tmp_path): _move(monkeypatch, MAN) _doc_move(monkeypatch, PCT, _rate("노무비 × 4%")) got = _at(proj, path.read, key) - assert got["셈"]["계"] == was["셈"]["계"] and got["사본"]["자동"] is False + assert got["셈"]["계"] == was["셈"]["계"] and got["사본"]["따라옴"] is None assert got["문서"]["금액"][TOOL]["단가"] == "노무비 × 5%" and got["사본"]["갱신"] == [] @@ -246,3 +246,23 @@ def test_machine_cover_kept_other_item(world, monkeypatch): got = _at(me, path.read, key) assert got["문서"]["기계덮음"] == {no: {"값": {"가격": 150000}}} assert [n["갈래"] for n in got["사본"]["갱신"]] == ["문서"] # 기계 줄 붙인 문서 고침 + + +def test_toast_mark_once_until_save(world, monkeypatch): + """㉧ 만든 뒤 = 지문 없음 · M01 값 바뀜 = 지문(두 번 열어도 같음 = 토스트 한 번) · [저장] 뒤 없음 · + 또 바뀌면 다른 지문.""" + me = world["personal"] + key = _sk(me) + _stack(me, key, [("자원", {"갈래": "요소", "키": MAN}, "노무비")]) + assert _at(me, path.read, key)["사본"]["따라옴"] is None + _move(monkeypatch, MAN) + one = _at(me, path.read, key) + assert ( + one["사본"]["따라옴"] and _at(me, path.read, key)["사본"]["따라옴"] == one["사본"]["따라옴"] + ) + _at(me, path.save, key, {"판": one["판"]}) + saved = _at(me, path.read, key) + assert saved["사본"]["따라옴"] is None and saved["셈"]["계"] == one["셈"]["계"] + _move(monkeypatch, MAN) # 한 번 더(네 배) + again = _at(me, path.read, key)["사본"]["따라옴"] + assert again and again != one["사본"]["따라옴"] diff --git a/resources/tester/test_848_10_upper_down.py b/resources/tester/test_848_10_upper_down.py index 1805351ae..91b1c6d89 100644 --- a/resources/tester/test_848_10_upper_down.py +++ b/resources/tester/test_848_10_upper_down.py @@ -140,15 +140,16 @@ def test_옵션_고름_지킴_알림_확인(world, docs_tmp): got = _read(me, other) # 다른 옵션을 고름 = 내 값 지킴 · 기초 옵션 따라옴 · 알림 없음 assert (_val(got["문서"], "타설방법"), _val(got["문서"], "지역")) == ("장비사용타설", "경기") assert got["사본"]["따로"] and got["사본"]["갱신"] == [] + assert got["사본"]["따라옴"] # 859-2 따로 문서 옵션이 따라옴 = 열 때 토스트 지문 got = _read(me, same) # 같은 옵션을 고름 = 내 값 지킴 + 알림 assert _val(got["문서"], "지역") == "서울" [note] = got["사본"]["갱신"] assert (note["갈래"], note["처리"]) == ("문서", "지킴") assert note["M01"] == ["지역 전국평균 → 경기"] and note["내고침"] == ["지역 서울"] - _at(me, path.save, same, {"할일": renew.CONFIRM, "판": got["판"]}) + _at(me, path.save, same, {"판": got["판"]}) # 859-2 [확인] 걷음 — [저장] 뒤에도 내 값 지킴 after = _read(me, same) - assert after["사본"]["갱신"] == [] and _val(after["문서"], "지역") == "서울" - assert after["셈"]["계"] == got["셈"]["계"] + assert after["사본"]["갱신"] == got["사본"]["갱신"] and _val(after["문서"], "지역") == "서울" + assert after["셈"]["계"] == got["셈"]["계"] and after["사본"]["따라옴"] is None got = _read(me, line) # 줄 고침 + 옵션 기본 바뀜 = 줄 고침 지킴(다시 복사 아님) · 옵션 따라옴 assert got["문서"]["금액"][0]["수량"] == "(Q_콘크리트공) × 2" assert _val(got["문서"], "지역") == "경기" and got["사본"]["갱신"] == [] diff --git a/resources/tester/test_848_2_cover_renew.py b/resources/tester/test_848_2_cover_renew.py index 453926451..064abfb91 100644 --- a/resources/tester/test_848_2_cover_renew.py +++ b/resources/tester/test_848_2_cover_renew.py @@ -153,7 +153,6 @@ def test_upper_only(world, monkeypatch): [note] = got["사본"]["갱신"] assert (note["경로"], note["층"], note["전"], note["후"]) == ("값.가격", "기초", PRICE, 200000) assert got["셈"]["계"] > was["셈"]["계"] # 안 고친 칸(주연료 ①) = 따라옴 · 가격 = 내 값 - assert not got["사본"]["문서새판"] def test_cut_kept_on_upper(world, monkeypatch): @@ -201,20 +200,20 @@ def test_structure_recopy(world, monkeypatch): def test_structure_recopy_saved(world, monkeypatch): - """㉤ 다시 복사한 뒤 알림 [확인](저장) = 기계 고침 · 옵션 값 남음 · 알림 없음.""" + """㉤ 다시 복사한 뒤 [저장] = 기계 고침 · 옵션 값 남음 · 알림 없음(859-2 [확인] 단추 걷음).""" me = world["personal"] cover = {"값": {"가격": 150000}} key = _cut_sk(me, cover=cover) _doc_move(monkeypatch, CUT, _grow) got = _read(me, key) - _at(me, path.save, key, {"할일": renew.CONFIRM, "판": got["판"]}) + _at(me, path.save, key, {"판": got["판"]}) after = _read(me, key) assert after["사본"]["갱신"] == [] and after["문서"]["기계덮음"] == {DIG_NO: cover} assert _size(after["문서"]) == "소규모" and after["셈"]["계"] == got["셈"]["계"] def test_save_keeps_base(world, monkeypatch): - """㉥ 확인 전 [저장](고친 문서 다시 저장) = 바탕 남아 알림 계속.""" + """㉥ [저장](고친 문서 다시 저장) = 바탕 남아 지킴 알림 계속 · 토스트 지문 없음(859-2 — 한 번만).""" me = world["personal"] key = _machine_sk(me, {"값": {"가격": 150000}}) _move(monkeypatch, DIG) @@ -222,19 +221,7 @@ def test_save_keeps_base(world, monkeypatch): _at(me, path.save, key, {"문서": got["문서"], "판": got["판"]}) again = _read(me, key) [note] = again["사본"]["갱신"] - assert (note["전"], note["후"]) == (PRICE, PRICE * 2) - - -def test_confirm_clears(world, monkeypatch): - """㉥ 알림 [확인] 뒤 = 안 뜸 · 내 값 그대로 · 금액 같음.""" - me = world["personal"] - key = _machine_sk(me, {"값": {"가격": 150000}}) - _move(monkeypatch, DIG) - got = _read(me, key) - _at(me, path.save, key, {"할일": renew.CONFIRM, "판": got["판"]}) - after = _read(me, key) - assert after["사본"]["갱신"] == [] and after["셈"]["계"] == got["셈"]["계"] - assert after["문서"]["기계덮음"] == {DIG_NO: {"값": {"가격": 150000}}} + assert (note["전"], note["후"]) == (PRICE, PRICE * 2) and again["사본"]["따라옴"] is None def test_project_keeps(world, monkeypatch): @@ -298,4 +285,4 @@ def test_upper_cover_keeps_edited_doc(world, monkeypatch): got = _read(me, key) assert got["사본"]["따로"] is True and got["사본"]["갱신"] == [] assert got["문서"]["금액"][TOOL]["단가"] == "노무비 × 5%" - assert got["셈"]["계"] == was["셈"]["계"] and not got["사본"]["문서새판"] + assert got["셈"]["계"] == was["셈"]["계"] diff --git a/resources/tester/test_856_0_sk_screen.py b/resources/tester/test_856_0_sk_screen.py index 5f5a92723..9efdab2b9 100644 --- a/resources/tester/test_856_0_sk_screen.py +++ b/resources/tester/test_856_0_sk_screen.py @@ -80,12 +80,10 @@ def test_labor_row_click_project_copy() -> None: def test_head_bands() -> None: got = _run() - # 자동 따라옴 알림 = M01 개정(노랑 + 빨강 배지) · 금액 없는 줄 = 빠진 줄(노랑) + # 자동 따라옴 알림 = 띠 · 배지 없음(859-2 토스트) · 금액 없는 줄 = 빠진 줄(노랑) b = got["bands"] - assert b["banners"] == ["warning", "warning"] and b["calc"] == 0 - assert b["badges"] == [["danger", "M02_SangeunRevisedBase"]] - assert b["texts"][0] == "M02_SangeunRevisedNote" - assert b["texts"][1] == "M02_SangeunGap — 특별인부" + assert b["banners"] == ["warning"] and b["calc"] == 0 and b["badges"] == [] + assert b["texts"][0] == "M02_SangeunGap — 특별인부" # 못 셈 = 빨강 하나 · 글 = 서버 `까닭` 과 같은 차례(틀림 › 표지 › 까닭 › 빈값) assert got["bands_why"]["banners"] == ["danger"] assert got["bands_why"]["texts"] == ["빈 문서 — 금액 줄 · 결과 없음"] diff --git a/ui_template/ui_template_locale_m2.ts b/ui_template/ui_template_locale_m2.ts index d33768375..3c7de5705 100644 --- a/ui_template/ui_template_locale_m2.ts +++ b/ui_template/ui_template_locale_m2.ts @@ -165,11 +165,6 @@ export const ui_locales_m2 = { M02_SangeunSwapCoef: ["환산 계수", "Conversion factor"], M02_SangeunSwapWeight: ["단위중량", "Unit weight"], M02_SangeunSwapPick: ["고르세요", "Choose"], - M02_SangeunRevisedBase: ["M01 개정 — 확인", "M01 revised — check"], - M02_SangeunRevisedNote: [ - "바탕 단가산출 기초가 저장 뒤 바뀜 — 고친 칸의 바탕 값을 확인하고 [저장]하면 새 판으로 맞춤", - "The base M01 logic changed since saving — check edited cells, then Save to adopt the new version", - ], M02_SangeunGap: [ "못 셈 줄 — 금액 빼고 나머지로 셈 · 줄을 빼거나 입력을 채움", "Lines not priced — total uses the rest · drop the line or fill its input",