fix(ТСН): справка для GLM показывает расчётную цену, а не падает на раскладке current

calc_position отдаёт current словарём (ПЗ/ОТ/ЭМ/МАТ), а подстановка форматировала его
как число: ошибка тонула в общем перехвате и человек получал «база недоступна».
Теперь из словаря берётся ПЗ, в тексте названы выпуск и коэффициент; при настоящем
сбое сообщение честное («справку собрать не удалось») и пишется в журнал.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
anor
2026-11-18 04:06:30 +10:00
co-authored by Claude Code
parent bb63a19050
commit 4f504805df
2 changed files with 15 additions and 5 deletions
+3 -1
View File
@@ -23,7 +23,8 @@ def _rate(monkeypatch):
monkeypatch.setattr(tsn_calc, "calc_position", lambda code, qty=1.0, as_of=None: {
"status": "ok", "code": code,
"base": {"pz": 320.63, "ot": 5.79, "em": 314.84, "mat": 0.0},
"current": 23405.99, "method": "3.1-5-1 × 73.0 (выпуск 222)",
"current": {"pz": 23405.99, "ot": 5.79, "em": 23400.2, "mat": 0.0},
"method": "rate_index",
"index": {"value": 73.0, "issue_no": "222", "quarter": 4, "year": 2026},
})
@@ -33,6 +34,7 @@ def test_moscow_rate_gives_base_and_calculated_price(monkeypatch):
out = qa_inject.tsn_qa_inject("Проверь расценку 1-5-1 по Москве")
assert "1-5-1" in out and "320,63" in out, out
assert "2000" in out and "выпуск 222" in out, out
assert "23 405,99" in out, out
assert "расчёт" in out, out
assert "find_in_tsn" not in out and "mcp__" not in out, "имена инструментов в тексте"