From 62af71e6b18c663159d2b44749c6379451b630a6 Mon Sep 17 00:00:00 2001 From: Nyan404 Date: Sat, 26 Sep 2026 00:19:09 +0300 Subject: [PATCH] feat: add explicit one-point catch catalogue --- MEMORY.md | 4 ++++ app/belki/domain.py | 9 +++++++++ docs/Новая Крыланы. [Памятка].md | 2 +- structure_and_data.md | 1 + tests/test_belki.py | 9 +++++++++ 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/MEMORY.md b/MEMORY.md index 58cef60..3d5eae6 100644 --- a/MEMORY.md +++ b/MEMORY.md @@ -86,3 +86,7 @@ The final gateway Dockerfile must copy `nginx.conf` into the release image, not # 2026-09-21: admin inspection score breakdown Inspection results persist the base score for the number of inspections and each resource's calculated contribution in addition to the total. `/admin` displays these details in a dedicated `Баллы` column without changing the VK/public report text; legacy rows fall back to the stored total. + +# 2026-09-26: explicit edible catch catalogue + +`app/belki/domain.py` keeps an explicit `EDIBLE_CATCHES` set for one-point inspection catches. `Ящерица` and `Летучая мышь` are included and covered by `tests/test_belki.py`; the Krylan memo lists them in the edible catch table. diff --git a/app/belki/domain.py b/app/belki/domain.py index 6cc0d67..27e96b3 100644 --- a/app/belki/domain.py +++ b/app/belki/domain.py @@ -29,6 +29,13 @@ MAX_INSPECTIONS = 100_000 MAX_INSPECTION_RESOURCES = 100 MAX_RESOURCE_AMOUNT = 100_000 +# Явные названия съедобного улова из памятки; каждая единица даёт 1 балл. +EDIBLE_CATCHES = frozenset({ + "белка", "ящерица", "бурая ящерица", "зелёная ящерица", + "бурундук", "воробей", "голубая сойка", "дятел", + "летучая мышь", "малиновка", "мышь", +}) + def parse_clock(value: str) -> int: """Преобразует строку 'HH:MM' в количество минут от начала суток.""" @@ -306,6 +313,8 @@ def _inspection_resource_value(name: str) -> int: letters = re.sub(r"[^а-я]", "", normalized) if "надпис" in letters or "гнезд" in letters: return 0 + if normalized in EDIBLE_CATCHES: + return 1 if "дич" in letters: return 1 if "ядовит" in letters: diff --git a/docs/Новая Крыланы. [Памятка].md b/docs/Новая Крыланы. [Памятка].md index 39bbe1b..cd1d892 100644 --- a/docs/Новая Крыланы. [Памятка].md +++ b/docs/Новая Крыланы. [Памятка].md @@ -81,7 +81,7 @@ | Категория | Что делать | | --- | --- | -| Съедобная дичь: белка, бурая/зелёная ящерица, бурундук, воробей, голубая сойка, дятел, летучая мышь, малиновка, мышь | Можно съесть или отнести в Большой круг. | +| Съедобная дичь: белка, ящерица (в том числе бурая/зелёная), бурундук, воробей, голубая сойка, дятел, летучая мышь, малиновка, мышь | Можно съесть или отнести в Большой круг; в осмотре каждая единица даёт 1 балл. | | Кусающая дичь: бурый/светлый/тёмный/тонколапый паук, луговая змея, пчела, щитомордник | При поимке травит; съесть на месте либо утилизировать. В Большой круг не относить. | | Ядовитая дичь: гадюка, полосатый аспид | Травит при поимке и съедении; включить в отчёт и утилизировать. В Большой круг не относить. | | Вьюнок, крепкая ветка | Утилизировать. | diff --git a/structure_and_data.md b/structure_and_data.md index 0e38912..45ea612 100644 --- a/structure_and_data.md +++ b/structure_and_data.md @@ -121,6 +121,7 @@ - 2026-08-25: `/belki` now applies a dedicated narrow-width layout: single-column forms and application types, full-width actions, compact panels/dialogs, 16px form text to avoid mobile browser zoom, and responsive tabs without horizontal overflow. - 2026-08-25: removed unreferenced root-level legacy BBCode copies `belki.md`, `belki2.md`, and `belkifix.md`; the first two were byte-identical and the third differed only by a closing BBCode tag. They were neither served nor referenced by the calculator, bot, or documentation. - 2026-09-21: `InspectionResult` now keeps the base inspection score and per-resource score entries alongside the total. The `/admin` report table renders these values in a dedicated `Баллы` column; older history rows still show their stored total when detailed fields are absent. The public report message remains unchanged. +- 2026-09-26: inspection scoring now has an explicit `EDIBLE_CATCHES` catalogue in `app/belki/domain.py`; `Ящерица` and `Летучая мышь` are documented as one-point catches and covered by regression tests. # Обновление 2026-08-16: несколько котят Калькулятор прокачки принимает `extra_kittens` из веб-формы, API и VK-команды. Общая выплата сопровождающему не суммирует полную ставку на каждого котёнка: первый подопечный использует базовый коэффициент, второй — множитель 1,5, каждый следующий — дополнительный множитель 1,15. Сайт добавляет строки дополнительных котят динамически; VK поддерживает сегмент `доп. котята: Имя [ID], Имя2 [ID]`. diff --git a/tests/test_belki.py b/tests/test_belki.py index 7578672..a795858 100644 --- a/tests/test_belki.py +++ b/tests/test_belki.py @@ -276,6 +276,15 @@ class ReportTests(unittest.TestCase): self.assertEqual(result.points, 7) self.assertEqual([item["points"] for item in result.resource_points], [3, 4]) + def test_inspection_scores_explicit_catches_at_one_point(self): + report = InspectionReport( + "Белка", 1, "дупло", 0, + (("Ящерица", 2), ("Летучая мышь", 3)), + ) + result = calculate_inspection(report) + self.assertEqual(result.points, 5) + self.assertEqual([item["points"] for item in result.resource_points], [2, 3]) + if __name__ == "__main__": unittest.main()