Files
Aislo/resources/tester/test_253_3_haul_preview.py
T
eomsangdonandClaude Opus 5.5 d909d6aabe feat(B09): 263-1 운반 단가 모달 = 고른 항목 입력만 + 거리 자동
- 사이클시간 입력 · 8-2-8 표 고르기 칸 없앰 · 사이클 = 8-2-8 기본값(계산 절차에만)
- 거리 칸(운반거리 · Cm · 사이클시간 · t2) = 거리에서 · 손 값 이김 · 거리 칸 없는 항목 = 사이클 줄 없음
- [변경] = 단가연결 한 목록(onPick) · [다른 종류] 없앰 · 조합 = [적용] 때 사본 들여옴 · 호표 = 그대로 연결
- 옛 cycle = 서버 읽기 그대로 · [적용]하면 지움

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JywHxQuWPk6UYXTebyrBoU
2026-10-11 16:36:35 +09:00

63 lines
2.7 KiB
Python

"""253-3 미리보기 길 `POST …/estimation/logic-preview` + 「운반 단가」 모달 — 거리이정표 우클릭 ·
설계내역서 운반공 줄에서 엶."""
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(ROOT))
from B08_Quantity.B08_Quantity_Haul_Cycle import cycle_time # noqa: E402
from B09_Estimation.B09_Estimation_Bill_Items import haul_items # noqa: E402
from B09_Estimation.B09_Estimation_Router import PreviewBody, logic_preview, router # noqa: E402
def _src(name: str) -> str:
return (ROOT / name).read_text(encoding="utf-8")
def test_미리보기_계산_절차(tmp_path):
cm = cycle_time({"L1": 25.1, "L2": 0.8})["cm"]
given = {"qt": 15, "f": 1, "E": 0.9, "Cm": cm, "지역": "전국평균"}
got = logic_preview(tmp_path, PreviewBody(code="GF000134", given=given))
assert got["unit"] == "㎥" and got["price"] and got["price"] > 0
assert "Cm : 109.78 분" in got["lines"]
assert any("60 * 15 * 1 * 0.9 / 109.78" in line for line in got["lines"])
assert got["lines"][-1].startswith("계 :")
# 거리 늘면 단가도 늘음
far = logic_preview(tmp_path, PreviewBody(code="GF000134", given={**given, "Cm": 200}))
assert far["price"] > got["price"]
def test_미리보기_길():
paths = {(r.path, tuple(r.methods)) for r in router.routes}
assert ("/api/projects/{project_id}/estimation/logic-preview", ("POST",)) in paths
def test_내역_줄_거리():
one = {"ref": None}
routes = [
{**one, "key": "haul:3", "name": "모래운반", "user": False, "L1": 25.1, "L2": 0.8},
{**one, "key": "haul:r-u1", "name": "깬돌운반", "user": True, "L1": 3, "L2": 1},
]
items = {i["key"]: i for i in haul_items(None, {}, routes)}
assert items["haul:3"]["dist"] == {"L1": 25.1, "L2": 0.8}
assert items["haul:r-u1"]["dist"] == {"L1": 3, "L2": 1}
assert items["haul:1"]["dist"] is None
def test_모달_여는_곳():
modal = _src("B09_Estimation/B09_Estimation_UI_Haul_Modal.ts")
for want in ("/estimation/logic-preview", "openPriceLink", "fetchLogicInputs", "fillGiven",
"cycleInputs", "my !== seq", "거리에서", "[고르기]"): # fmt: skip
assert want in modal, want
milestone = _src("B08_Quantity/B08_Quantity_UI_Milestone.ts")
assert "openHaulModal({" in milestone and "L1: paved" in milestone
link = _src("B09_Estimation/B09_Estimation_UI_Tabs_Bill_Link.ts")
assert '[["단가연결", haul ? haulModal : priceLink]]' in link
edit = _src("B09_Estimation/B09_Estimation_UI_Tabs_Bill_Edit.ts")
assert (
'key.startsWith("haul:")' in edit
and "linkItems(ctx, ref, applyRef(ctx, rows, i), haul)" in edit
)