feat(831-1): 단가산출 기초 목록 책 차례 = 건설품셈 → 산림품셈 → 자체

- 정본 = 장 파일 머리 「차례」(order_chapters) — 건설 공통·토목·건축·기계설비·유지관리 → 산림 → 자체 로 다시 매김(소요량 · 계수 · 로직 144 파일 머리 한 줄씩)
- 「차례」 없는 파일(자체)은 맨 뒤 — chapter_order 한 곳 · M01 목록 · 로직 목록 · M02 기준 목록 셈 순서가 같이 따름
- 낡은 시험 test_m01_api 의 산림 먼저 단정 2 줄 고침 · 지킴 시험 test_843_book_order 추가
- 로직 내용 · 키 · 금액 그대로

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-15 09:43:23 +09:00
co-authored by Claude Sonnet 5.5
parent 4aba3bfe53
commit e4580ecf09
146 changed files with 183 additions and 150 deletions
+9 -2
View File
@@ -341,15 +341,22 @@ def _strings(v):
yield from _strings(x)
BOOK_ORDER = ("건설품셈", "산림품셈", "자체") # 목록 책 차례
def order_chapters(folder: Path = MASTER) -> None:
"""장 파일 머리 「차례」 — 그룹마다 산림 1~14장 → 건설 공통 · 토목 · 건축 · 기계설비 · 유지관리."""
"""장 파일 머리 「차례」 — 그룹마다 건설 공통 · 토목 · 건축 · 기계설비 · 유지관리 → 산림 1~14장 → 자체."""
found = {}
for path in folder.glob("*.json"):
m = CHAPTER.match(path.name)
if m:
data = _read(path)
division = data.get("부문") or ""
rank = (m[2] != "산림품셈", DIVISIONS.index(division) if division else -1, int(m[3]))
rank = (
BOOK_ORDER.index(m[2]),
DIVISIONS.index(division) if division else -1,
int(m[3]),
)
found.setdefault(m[1], []).append((rank, path.name, data.get("차례")))
for items in found.values():
for i, (_, name, had) in enumerate(sorted(items), start=1):