diff --git a/M01_MasterData/M01_MasterData_Store.py b/M01_MasterData/M01_MasterData_Store.py index 3cb80e821..b6b6efb2e 100644 --- a/M01_MasterData/M01_MasterData_Store.py +++ b/M01_MasterData/M01_MasterData_Store.py @@ -390,8 +390,8 @@ def logics(sub: str, detail: str, q: str, blocked: int | None, owner: str = "") def logic(key: str) -> dict: - """로직 하나 — 키는 전체에서 하나 · 있는지 · 파일 · 이름표 = 수식 문서(855 L2 ⓐ) · 셈 칸(입력 · 호표 …) - · `prices` · `version` = 로직 파일(옛 상세 몸 · 저장 짝 — 856 · L3 에서 걷음).""" + """로직 하나 — 키는 전체에서 하나 · 있는지 · 파일 · 이름표 = 수식 문서(855 L2 ⓐ) · + 셈 칸(입력 · 호표 …) · `version` = 로직 파일(화면 [저장]이 줄째 되돌려 씀 — L3 에서 걷음).""" files, whole = loaded() name, doc = _docs().find(key) row = next((r for r in (files.get(name) or {}).get("줄") or [] if str(r.get("키")) == key), {}) @@ -404,7 +404,6 @@ def logic(key: str) -> dict: "logic": row, "blocked": bool(reasons), "reasons": reasons, - "prices": _prices(whole, row), } @@ -418,42 +417,6 @@ def _brief(ref: str, row: dict) -> dict: } -def _pick_brief(whole, cond: dict, unit: str | None = None) -> dict | None: - """고르기 조건 줄의 단가 미리보기 — 후보 수와 시험 계산이 쓸 줄(값 열 다섯 포함). - `unit` = 호표 줄 단위 — 후보를 같은 단위 줄로만 거름.""" - try: - keys = cm.mf.candidates(whole, cond, {}, unit) - brief = _market_brief(whole.get(cm.mf.pick(whole, cond, {}, unit))) - except (cm.mf.FormulaError, KeyError, TypeError): - return None - return {**brief, "조건": cond, "후보": len(keys)} - - -def _prices(whole, row: dict) -> dict: - """호표 요소 → 요소 줄 요약(단가 자동 칸) · `{이름}` 낀 원문번호·하위 로직은 계산 때 정해짐. - 품셈재료는 연결을 따라간 낮은 값과 출처 · 자재지역 후보는 계산 때 정해짐(값 None). - 재료 고르기 조건 줄은 열쇠가 조건 글(`구분|상세구분|규격|대표`) · 값 = 시험 계산이 쓸 줄.""" - out = {} - for item in row.get("호표") or []: - if isinstance(item.get("요소"), dict): - out[cm.mf.cond_text(item["요소"])] = _pick_brief(whole, item["요소"], item.get("단위")) - continue - ref = str(item.get("요소", "")) - if item.get("종류") != "로직" and "{" not in ref: - try: - out[ref] = _brief(ref, whole.get(ref)) - except cm.mf.FormulaError: - out[ref] = None - continue - if ref[:2] == cm.mf.LINKED: - try: - value, source = cm.mf.element(whole, ref, {}) - except (cm.mf.FormulaError, KeyError, TypeError): - value, source = None, None - out[ref].update({"값": value, "출처": source}) - return out - - def elements(group: str, q: str, limit: int) -> dict: """요소 찾기 창 — 그룹 전체에서 키·원문번호·이름 찾기 · `ref` 는 식에 그대로 넣는 키.""" if group not in cm.mf.GROUPS: diff --git a/M01_MasterData/M01_MasterData_Store_Make.py b/M01_MasterData/M01_MasterData_Store_Make.py index 5f1dec18d..2718e60fa 100644 --- a/M01_MasterData/M01_MasterData_Store_Make.py +++ b/M01_MasterData/M01_MasterData_Store_Make.py @@ -404,7 +404,6 @@ def logic_formula(key: str) -> dict: "version": got["version"], "key": key, "소유": got["logic"].get("소유") or "", - "prices": got["prices"], **mcp.spread(master, got["logic"]), } diff --git a/M01_MasterData/M01_MasterData_UI_Logic_Api.ts b/M01_MasterData/M01_MasterData_UI_Logic_Api.ts index 8685767a5..11adb2238 100644 --- a/M01_MasterData/M01_MasterData_UI_Logic_Api.ts +++ b/M01_MasterData/M01_MasterData_UI_Logic_Api.ts @@ -87,7 +87,6 @@ export interface LogicOne { logic: LogicRow; blocked: boolean; reasons: string[]; - prices: Record; } export interface CalcLine { @@ -270,7 +269,6 @@ export interface LogicFormula { version: string; key: string; 소유: string; - prices: Record; 로직: LogicRow; 별칭: FormulaAlias[]; 줄: FormulaLine[]; diff --git a/resources/tester/test_m01_api.py b/resources/tester/test_m01_api.py index 682ef3c23..5082983d2 100644 --- a/resources/tester/test_m01_api.py +++ b/resources/tester/test_m01_api.py @@ -258,8 +258,6 @@ def test_요소_찾기_기계는_구분_상세구분_실림(client: TestClient) def test_단가_자동_요소_찾기_저장전_시험계산(client: TestClient) -> None: one = _get(client, "/api/m01/logic", key=LOGIC_KEY) - labor = one["prices"][key_of("LB:1016")] - assert labor["이름"] == "화약취급공" and labor["값"] > 0 found = _get(client, "/api/m01/elements", group="인력", q="보통인부") assert key_of("LB:1002") in [x["ref"] for x in found["items"]] tables = _get(client, "/api/m01/elements", group="소요량", q="암발파", limit=5) @@ -387,21 +385,11 @@ def test_구분_목록(client: TestClient) -> None: assert steel["details"] -def test_재료_고르기_줄_단가는_검색어_첫째_자재품목의_낮은_값(client: TestClient) -> None: - """옛 대표 키 줄이 기본 검색어로 바뀜(PLAN 8-3) — 값은 검색어 첫째(옛 대표) 줄의 낮은 값.""" - one = _get(client, "/api/m01/logic", key=key_of("GC000628")) - cond = {"구분": "시멘트·골재", "상세구분": "시멘트", "검색어": "시멘트 전국"} - cement = one["prices"][store.cm.mf.cond_text(cond)] - assert cement["ref"] == "MT004176" and cement["값"] > 0 and cement["후보"] >= 1 - - def test_전력은_계약종별을_골라야_값이_섬(client: TestClient) -> None: """후보 조건 「계약종별: 입력」(PLAN 7-4b 뒤 절반 — 품셈재료 간접 없이 호표에 바로 박음) — - 계산은 로직 입력으로 값이 섬(mf.element 로 직접 확인). 화면 단가 미리보기(_pick_brief)는 - 구분·상세구분 자리로만 후보를 찾아 지역·계약종별 조건은 아직 못 다뤄 None — 아는 구멍.""" + 계산은 로직 입력으로 값이 섬(mf.element 로 직접 확인).""" one = _get(client, "/api/m01/logic", key=key_of("GC000893")) cond = {"이름": "전력량요금", "계약종별": "입력"} - assert one["prices"][store.cm.mf.cond_text(cond)] is None assert "전력 계약종별" in {x["이름"] for x in one["logic"]["입력"]} with pytest.raises(store.cm.mf.FormulaError, match="전력 계약종별"): store.cm.mf.element(store.cm.master(), cond, {}) @@ -531,25 +519,3 @@ def test_재료_고르기_후보_다섯_값(client: TestClient) -> None: } assert first["값"] == 18000 and first["관급"] is True # 조달청 100 은 낮은 값에 안 듦 assert second["ref"] == blank["키"] and second["값"] is None - - -def test_로직_고르기_줄_단가_미리보기(client: TestClient) -> None: - """호표 요소가 고르기 조건인 줄 — `prices` 열쇠 = 조건 글 · 후보 수와 값 열 다섯.""" - for path in sorted(store.FOLDER.glob("로직_*.json")): - rows = json.loads(path.read_text(encoding="utf-8"))["줄"] - hit = next( - ( - (row, item["요소"]) - for row in rows - for item in row.get("호표") or [] - if isinstance(item.get("요소"), dict) - ), - None, - ) - if hit: - break - row, cond = hit - got = _get(client, "/api/m01/logic", key=row["키"]) - brief = got["prices"][store.cm.mf.cond_text(cond)] - assert brief["조건"] == cond and brief["후보"] >= 1 - assert set(brief["값들"]) == set(store.cm.mf.SLOTS)