코드 - 고정 줄 단가 = M02_Labor_Fixed.line(사본 묶음 · 이은 노임 · 자재 = 묶음 값) — B09 단가 책으로 다시 안 덮음 - 대가 · 산근 고친 칸 = 품만 실제로(단가 칸 덮기 줄 남던 흠 · 품 고친 뒤 줄 금액 다시 셈 흠 py · ts 짝) - 산근 글 = 엔진 단가 셈 그대로 · 별도계상 재료 줄 끝 「· 별도계상 = 0.0」 · 계 줄 = 블록 합 - 노무비 · 중기목록 이름에서 규격 겹침 뗌 · TS 바탕 셈 이름 PARTS → MACHINE_PARTS(짝 시험이 TS 를 이어 붙일 때 겹침) 시험(고친 까닭 = 단가 원천이 B09 책 → M02 엔진 · 노임 · 기계 덮개 · 단가 고친 칸 · 중기사용료 걷음) - 144 바탕 · 뼈대: 운전사 · 중기사용료 · 경비 · 덮개 시험 걷음 → 노무 · 중기 나열 · 사급 표시 · 자재만 책 - 145-1 · 145-2 · 155 · 157-1 · 166-2 · 166-6 · 719-3 · 719-4 · 723-4 · 778-4 · 792-3: 줄 단가 = own(엔진) · 산근 = Solver() · collect 새 부름 꼴 - 702 · 705-1 · 719-2: 단가 칸 덮개 = 안 읽음 · 고정 줄 = M02 셈(노임 새 판 따라가기 시험 걷음) - 203-1 · 296 · 703-3 · 795-4: 단가 책 = 자재 줄로 - 707 · 707-6 · 707-7: 단가표 불러오기 = 자재만 · 거창 이은 안내판 줄 = M02 사본 셈(엑셀 −50,000) - 201-1: 환율 · 중기사용료 표 걷음 · b09 저장 속도: 산근 앞 풀이 그대로(단가 표 같음 견줌 걷음) - 대상 113 파일 764 통과 · 25 실패 = 원래 실패(formatMoney · formatPrice 없음 · 단위 글 ㎜ · sec · 719-1 · 796-2e · 717-4 · 721 · 311 · 243 · 246) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
91 lines
4.6 KiB
Python
91 lines
4.6 KiB
Python
"""296 B09 [업데이트] — 지워진 복사 정보는 업데이트에서 뺌(요구 190-4).
|
|
|
|
- ① B09 에서 지운 복사 항목 = 화면 캐시(user)를 같이 보냄 → 그 줄이 안 잇는 서고 사본 =
|
|
수요에서 뺌 · 책에 안 살아남 · 캐시 그대로(지운 줄 안 되살림) · 저장은 안 함
|
|
- ② M01 원본이 지워진 키 = 옛 책 줄 그대로(지우지도 바꾸지도 않음) · 낡음 까닭에서 빠짐
|
|
- 나머지 = 지금처럼 M01 값으로 새로 굳힘 · user 안 보내면 옛 길 그대로
|
|
임시 층(견본 마스터 · 임시 storage) · 실제 마스터 · 프로젝트는 안 씀.
|
|
"""
|
|
|
|
import asyncio
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
if str(ROOT) not in sys.path:
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
from B09_Estimation import B09_Estimation_Bill_Library as library # noqa: E402
|
|
from B09_Estimation import B09_Estimation_Prices as prices # noqa: E402
|
|
from B09_Estimation import B09_Estimation_Router as router # noqa: E402
|
|
from B09_Estimation import B09_Estimation_Store as store_b09 # noqa: E402
|
|
from B09_Estimation.B09_Estimation_Linked import linked_resource_keys # noqa: E402
|
|
from resources.tester.test_204_2_b09_bill_library import COMBO, world # noqa: E402, F401
|
|
|
|
|
|
def _json(book):
|
|
return json.loads(json.dumps(book, ensure_ascii=False))
|
|
|
|
|
|
def _refresh(monkeypatch, root, body):
|
|
seen = {}
|
|
|
|
async def fake_root(_):
|
|
return root
|
|
|
|
async def fake_payload(_, at, draft=None):
|
|
seen["draft"] = draft
|
|
return {}
|
|
|
|
monkeypatch.setattr(router, "_project_root", fake_root)
|
|
monkeypatch.setattr(router, "payload", fake_payload)
|
|
asyncio.run(router.refresh_prices("00000000-0000-0000-0000-000000000001", body))
|
|
return store_b09.read_book(root), seen["draft"]
|
|
|
|
|
|
def test_지운_복사_항목_업데이트_뒤_안_살아남(world, monkeypatch): # noqa: F811
|
|
root = world["root"]
|
|
a = library.import_copy(root, "precombo", "system", None, world["key"])["폴더"]
|
|
b = library.import_copy(root, "combo", "system", None, COMBO)["폴더"]
|
|
keep_a = set(prices.refresh_book(linked_resource_keys(root, {a}))["rows"])
|
|
every = set(prices.refresh_book(linked_resource_keys(root))["rows"])
|
|
assert keep_a < every # b 사본만 부르는 줄이 있음
|
|
# 화면 캐시 = b 줄을 지움(아직 [저장] 안 함 · 사본 폴더는 남음)
|
|
ref = {"tab": "dg", "key": "DG:x", "lib": a}
|
|
user = {"bill": {"v": 2, "rows": [{"key": "hand:1", "name": "줄", "qty": 1, "ref": ref}]}}
|
|
book, draft = _refresh(monkeypatch, root, {"user": user})
|
|
assert set(book["rows"]) == keep_a # 지운 사본 단가 줄 안 살아남
|
|
assert draft["bill"]["rows"][0]["ref"]["lib"] == a # 응답 셈도 캐시로
|
|
assert not (store_b09.folder(root) / store_b09.USER).exists() # 저장 안 함
|
|
assert {f.name for f, _ in library.copies(root)} == {a, b} # 사본 정리는 [저장] 몫
|
|
assert prices.book_stale(_json(book), linked_resource_keys(root, {a})) is None
|
|
# user 안 보냄 = 옛 길(다 쓴 사본 전부)
|
|
book, draft = _refresh(monkeypatch, root, None)
|
|
assert set(book["rows"]) == every and draft is None
|
|
|
|
|
|
def test_M01_원본_없는_항목_값_그대로_낡음_까닭_빠짐():
|
|
gone = "MT999999" # 841-1 책 = 자재만 — 원본 없는 자재 키
|
|
keys = ["MT000401", "MT000338", gone]
|
|
old = _json(prices.refresh_book(["MT000401", "MT000338"]))
|
|
kept = {"key": gone, "name": "지워진 자재", "origin": "M01", "prices": {"물가자료": 123.0}}
|
|
old["rows"][gone] = kept
|
|
old["rows"]["MT000401"] = {**old["rows"]["MT000401"], "prices": {}} # M01 에서 바뀐 단가
|
|
assert prices.book_stale(old, keys) == "M01 에서 바뀐 단가 1" # 원본 없는 줄 = 까닭에 없음
|
|
new = _json(prices.refresh_book(keys, old))
|
|
assert new["rows"][gone] == kept # 지우지도 바꾸지도 않음
|
|
assert new["rows"]["MT000401"]["prices"] != {} # 나머지 = 새로 굳힘
|
|
assert set(new["rows"]) == set(old["rows"])
|
|
assert prices.book_stale(new, keys) is None
|
|
assert gone not in prices.refresh_book(keys)["rows"] # 옛 책 없으면 줄 없음(옛 길)
|
|
|
|
|
|
def test_화면_업데이트_캐시_보냄_그대로_둠():
|
|
shell = (ROOT / "B09_Estimation/B09_Estimation_UI_Shell.ts").read_text("utf-8")
|
|
at = shell.index('"/estimation/prices",')
|
|
assert "{ user, ...(refresh.dataset.b09Job" in shell[at : at + 200] # 795-4 할일 덧칸
|
|
assert "\n true," in shell[at : at + 200]
|
|
assert 'if (!keep) clearState("b09-estimation", projectId);' in shell
|
|
assert "apply(next, !keep);" in shell
|