feat(срез 4.3): подключён resolve_nr_sp в strict-путь движка (НР/СП из реальных смет)

strict без overhead_config → НР/СП из resolve_nr_sp, None → fail-loud missing.
С config/non-strict — прежний путь (SSR не тронут, 29 тестов зелёные).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
anor
2026-07-17 21:26:56 +10:00
co-authored by Claude Opus 4.8
parent 74b08cfe20
commit 038d4a1b75
+14 -3
View File
@@ -12,6 +12,7 @@ from smeta_railway.calc.coefficients import (
get_coefficients,
)
from smeta_railway.calc.overhead import calc_overhead, get_overhead_percents
from smeta_railway.data.nr_sp_map import resolve_nr_sp
from smeta_railway.config import (
CoefficientConfig,
LimitedCostsConfig,
@@ -267,9 +268,19 @@ class EstimateCalculator:
pz = round(ot_cost + em_total_cost + mat_total_cost, 2)
fot = round(ot_cost + otm_total_cost, 2)
nr_pct, sp_pct, *_ = get_overhead_percents(
item.code, self.overhead_config
)
# strict без явного overhead_config → НР/СП из реальных смет (resolve_nr_sp),
# None → fail-loud (не подставлять хардкод «ж/д»). С config или в non-strict —
# прежний путь (SSR/wizard не ломаем).
if self.strict and self.overhead_config is None:
rs = resolve_nr_sp(item.code)
if rs is None:
self._missing.append({"code": item.code,
"reason": "НР/СП не определены (сборника нет в корпусе)"})
nr_pct, sp_pct = 0.0, 0.0
else:
nr_pct, sp_pct, _conf = rs
else:
nr_pct, sp_pct, *_ = get_overhead_percents(item.code, self.overhead_config)
nr, sp = calc_overhead(fot, nr_pct, sp_pct)
total = round(pz + nr + sp, 2)