fix(M02): 구조물집계표 길이 = 구간형은 시작~종료 먼저(87-2)

- 옛 length_m 이 앞서 범위를 고쳐도 집계 길이가 안 따라오던 흠 고침 · 점형은 입력 길이 그대로
- 시험: test_m02_table_fill 길이 우선순위 하나 더함

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BVPp2o6Mh2FZJr72yW3ofZ
This commit is contained in:
2026-10-08 12:04:28 +09:00
co-authored by Claude Sonnet 5.5
parent fc36f0ae4e
commit 6588db2cb2
2 changed files with 12 additions and 4 deletions
+4 -4
View File
@@ -194,11 +194,11 @@ def _label(key: str, value: Any) -> str:
def _length(item: dict[str, Any]) -> float | None:
stated = _number(item["options"].get("length_m"))
if stated:
return stated
# 구간형은 시작~종료가 먼저(노면공 87-2) — 옛 length_m 은 범위를 고쳐도 안 따라옴
start, end = _number(item.get("start_m")), _number(item.get("end_m"))
return abs(end - start) if start is not None and end is not None else None
if start is not None and end is not None:
return abs(end - start)
return _number(item["options"].get("length_m")) or None
def _source_value(source: dict[str, Any], item: dict[str, Any]) -> float | None:
+8
View File
@@ -216,3 +216,11 @@ def test_측점이_없어진_손_값은_맨_아래_비고_줄로(project: Path)
assert last["값"] == {"sta": "NO.27+15", "h_intake": 1, "memo": "설계에서 측점 없어짐"}
kept = fill.strip_design(doc)
assert kept["줄"][-1]["값"]["h_intake"] == 1 # 다음 저장에도 남음
def test_집계_길이는_구간형이면_시작_종료가_먼저(project: Path) -> None:
# 노면공 87-2 — 범위를 고쳐도 옛 length_m 이 안 앞섬
moved = {"start_m": 200, "end_m": 245, "options": {"length_m": 30}}
assert fill._length(moved) == 45
assert fill._length({"options": {"length_m": 12}}) == 12 # 점형 · 구간 없음 = 입력 길이
assert fill._length({"options": {}}) is None