feat(717-2a): 단가산출 목록 줄 덧칸 — 바탕(로직 키 · 이름 | 참조 SK | 없음) · 고친 줄 수 · 쓰는 곳 수

- M02_Labor_Ref.summary sangeun 갈래만(브레인 답 A · 그 함수 밖 안 만짐)
- 지킴 시험 test_717_2a_sangeun_list 2(임시 storage)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-01 15:59:51 +09:00
co-authored by Claude Opus 5.5
parent 288af5cf9e
commit c0851ee63b
2 changed files with 67 additions and 0 deletions
+13
View File
@@ -299,6 +299,19 @@ def summary(folder: Path, kind: str, key: str, expand: Expand | None = None) ->
layer, owner = where(folder)
base = expand({"층": layer, "주인": owner, "키": key}).get("기준") or {}
out["기준금액"] = float(base["계"]) if "계" in base else None
# 717-2a 목록 열 — 바탕(로직 「키 이름」 | 참조 키 | None) · 고친 줄 수 · 쓰는 곳 수
if kind == "sangeun":
top, (layer, owner) = doc.get("바탕") or {}, where(folder)
logic = top.get("로직")
out["바탕"] = logic or (top.get("참조") or {}).get("키")
if logic and expand is not None:
try:
out["바탕"] = f"{logic} {expand.whole.logic(logic).get('이름') or ''}".strip()
except Exception: # noqa: BLE001 — 없는 로직 = 키만(셈 때 까닭)
pass
out["고친줄수"] = sum(len(doc.get(k) or ()) for k in ("덮개", "더한줄", "뺀줄"))
# ponytail: SK 마다 모든 층 훑음(users) — 목록이 느려지면 층 훑기 한 번 셈으로
out["쓰는곳수"] = len(users({"층": layer, "주인": owner, "키": key}))
return out