From 038d4a1b75ca78ec34864fb0515ad85a6185f7dc Mon Sep 17 00:00:00 2001 From: anor Date: Fri, 17 Jul 2026 21:26:56 +1000 Subject: [PATCH] =?UTF-8?q?feat(=D1=81=D1=80=D0=B5=D0=B7=204.3):=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=B4=D0=BA=D0=BB=D1=8E=D1=87=D1=91=D0=BD=20resolve=5Fnr?= =?UTF-8?q?=5Fsp=20=D0=B2=20strict-=D0=BF=D1=83=D1=82=D1=8C=20=D0=B4=D0=B2?= =?UTF-8?q?=D0=B8=D0=B6=D0=BA=D0=B0=20(=D0=9D=D0=A0/=D0=A1=D0=9F=20=D0=B8?= =?UTF-8?q?=D0=B7=20=D1=80=D0=B5=D0=B0=D0=BB=D1=8C=D0=BD=D1=8B=D1=85=20?= =?UTF-8?q?=D1=81=D0=BC=D0=B5=D1=82)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit strict без overhead_config → НР/СП из resolve_nr_sp, None → fail-loud missing. С config/non-strict — прежний путь (SSR не тронут, 29 тестов зелёные). Co-Authored-By: Claude Opus 4.8 (1M context) --- src/smeta_railway/calc/estimate.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/smeta_railway/calc/estimate.py b/src/smeta_railway/calc/estimate.py index e3807b3..d5514ea 100644 --- a/src/smeta_railway/calc/estimate.py +++ b/src/smeta_railway/calc/estimate.py @@ -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)