Merge remote-tracking branch 'origin/sub_desktop_1' into main_laptop_1 — 166-2 설계내역서 손질(Store docstring · import 양쪽 살림)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LLCk2y5xE8YGVgjbTntWsY
This commit is contained in:
@@ -64,10 +64,11 @@ def compute_sheets(root: Path, inputs: dict[str, Any], user: dict[str, Any]) ->
|
||||
|
||||
화면 짝 = `B09_Estimation_UI_Shell.computeSheets`(산근만 서버 답 그대로)."""
|
||||
base = compute_base(inputs, user)
|
||||
sg = sangeun.build(root, base) # 145-1 — 굳힌 단가로 풀이
|
||||
sg = sangeun.build(root, base, user) # 145-1 — 굳힌 단가로 풀이(+ 166-2 손 줄 로직)
|
||||
by_key = {row["key"]: row for row in sg["sg_list"]}
|
||||
labor = compute_labor(inputs.get("daega"), {**base, "gaps": []}, by_key)
|
||||
sheets = compute_estimation(inputs, user, lambda owner: daega_price(labor, owner))
|
||||
books = {"daega": labor["daega"], "sg_list": sg["sg_list"], "sg_hand": sg["sg_hand"]}
|
||||
sheets = compute_estimation(inputs, user, lambda owner: daega_price(labor, owner), books)
|
||||
sheets.update(sg)
|
||||
sheets.update({k: v for k, v in labor.items() if k != "gaps"})
|
||||
sheets["gaps"] = [*sheets["gaps"], *sg["sg_gaps"], *labor["gaps"]]
|
||||
@@ -78,10 +79,18 @@ def compute_sheets(root: Path, inputs: dict[str, Any], user: dict[str, Any]) ->
|
||||
return sheets
|
||||
|
||||
|
||||
async def _demand(root: Path) -> list[str]:
|
||||
"""단가 수요 키 — 연결된 사본 + 설계내역서 손 줄 로직(166-2)."""
|
||||
keys = await asyncio.to_thread(linked_resource_keys, root)
|
||||
user = await asyncio.to_thread(store.read_user, root)
|
||||
hand = await asyncio.to_thread(sangeun.hand_resource_keys, user)
|
||||
return [*keys, *(k for k in hand if k not in keys)]
|
||||
|
||||
|
||||
async def payload(project_id: UUID, root: Path) -> dict[str, Any]:
|
||||
notes: list[str] = []
|
||||
b08 = await _b08(project_id, notes)
|
||||
keys = await asyncio.to_thread(linked_resource_keys, root)
|
||||
keys = await _demand(root)
|
||||
if not keys:
|
||||
notes.append(
|
||||
"연결된 구조물 조합 사본 없음 — 노무 · 경비 · 중기 단가 줄은 사본이 연결되면 생김"
|
||||
@@ -116,7 +125,7 @@ async def estimation(project_id: UUID) -> dict[str, Any]:
|
||||
async def save_estimation(project_id: UUID, body: dict[str, Any] = Body(...)) -> dict[str, Any]:
|
||||
root = await _project_root(project_id)
|
||||
await asyncio.to_thread(store.write_user, root, body.get("user"))
|
||||
keys = await asyncio.to_thread(linked_resource_keys, root)
|
||||
keys = await _demand(root)
|
||||
book = await asyncio.to_thread(store.read_book, root)
|
||||
book = await asyncio.to_thread(prices.extend_book, book, keys)
|
||||
await asyncio.to_thread(store.write_book, root, book)
|
||||
@@ -126,7 +135,7 @@ async def save_estimation(project_id: UUID, body: dict[str, Any] = Body(...)) ->
|
||||
@router.post("/{project_id}/estimation/prices")
|
||||
async def refresh_prices(project_id: UUID) -> dict[str, Any]:
|
||||
root = await _project_root(project_id)
|
||||
keys = await asyncio.to_thread(linked_resource_keys, root)
|
||||
keys = await _demand(root)
|
||||
book = await asyncio.to_thread(prices.refresh_book, keys)
|
||||
await asyncio.to_thread(store.write_book, root, book)
|
||||
return await payload(project_id, root)
|
||||
|
||||
Reference in New Issue
Block a user