refactor(855-E 2-E1): /logic · /logic/formula 답의 옛 단가 미리보기(prices) 걷음
- 읽는 곳 = 옛 상세 몸 재료 · 표 모달뿐(9c7807297 에 걷음) · 서버 모듈 · B08 · B09 0 → Store._prices · _pick_brief · 두 답의 prices 걷음
- 남김: /logic 셈 칸(입력 · 호표 …) · version — 화면 [저장]이 줄째 받아 /save 로 되돌려 씀(L3)
- 서버 답 243 건 전후 — prices(139 답) · 지문 말고 다름 0
- 시험: test_m01_api 의 단가 미리보기 단언 셋(한 시험 통째 · 두 시험 그 줄) 걷음 · 관련 1,157(마지막 판) 통과 · 빌더 --check 같음 · typecheck 0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user