feat: add explicit one-point catch catalogue

This commit is contained in:
nyan404 committed 2026-09-26 00:19:09 +03:00
1 parent 3ae0257c46
commit 62af71e6b1
5 files changed
+24 -1

No files matched your search

+4
View File
@@ -86,3 +86,7 @@ The final gateway Dockerfile must copy `nginx.conf` into the release image, not
# 2026-09-21: admin inspection score breakdown # 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. 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.
+9
View File
@@ -29,6 +29,13 @@ MAX_INSPECTIONS = 100_000
MAX_INSPECTION_RESOURCES = 100 MAX_INSPECTION_RESOURCES = 100
MAX_RESOURCE_AMOUNT = 100_000 MAX_RESOURCE_AMOUNT = 100_000
# Явные названия съедобного улова из памятки; каждая единица даёт 1 балл.
EDIBLE_CATCHES = frozenset({
"белка", "ящерица", "бурая ящерица", "зелёная ящерица",
"бурундук", "воробей", "голубая сойка", "дятел",
"летучая мышь", "малиновка", "мышь",
})
def parse_clock(value: str) -> int: def parse_clock(value: str) -> int:
"""Преобразует строку 'HH:MM' в количество минут от начала суток.""" """Преобразует строку 'HH:MM' в количество минут от начала суток."""
@@ -306,6 +313,8 @@ def _inspection_resource_value(name: str) -> int:
letters = re.sub(r"[^а-я]", "", normalized) letters = re.sub(r"[^а-я]", "", normalized)
if "надпис" in letters or "гнезд" in letters: if "надпис" in letters or "гнезд" in letters:
return 0 return 0
if normalized in EDIBLE_CATCHES:
return 1
if "дич" in letters: if "дич" in letters:
return 1 return 1
if "ядовит" in letters: if "ядовит" in letters:
@@ -81,7 +81,7 @@
| Категория | Что делать | | Категория | Что делать |
| --- | --- | | --- | --- |
| Съедобная дичь: белка, бурая/зелёная ящерица, бурундук, воробей, голубая сойка, дятел, летучая мышь, малиновка, мышь | Можно съесть или отнести в Большой круг. | | Съедобная дичь: белка, ящерица (в том числе бурая/зелёная), бурундук, воробей, голубая сойка, дятел, летучая мышь, малиновка, мышь | Можно съесть или отнести в Большой круг; в осмотре каждая единица даёт 1 балл. |
| Кусающая дичь: бурый/светлый/тёмный/тонколапый паук, луговая змея, пчела, щитомордник | При поимке травит; съесть на месте либо утилизировать. В Большой круг не относить. | | Кусающая дичь: бурый/светлый/тёмный/тонколапый паук, луговая змея, пчела, щитомордник | При поимке травит; съесть на месте либо утилизировать. В Большой круг не относить. |
| Ядовитая дичь: гадюка, полосатый аспид | Травит при поимке и съедении; включить в отчёт и утилизировать. В Большой круг не относить. | | Ядовитая дичь: гадюка, полосатый аспид | Травит при поимке и съедении; включить в отчёт и утилизировать. В Большой круг не относить. |
| Вьюнок, крепкая ветка | Утилизировать. | | Вьюнок, крепкая ветка | Утилизировать. |
+1
View File
@@ -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: `/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-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-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: несколько котят # Обновление 2026-08-16: несколько котят
Калькулятор прокачки принимает `extra_kittens` из веб-формы, API и VK-команды. Общая выплата сопровождающему не суммирует полную ставку на каждого котёнка: первый подопечный использует базовый коэффициент, второй — множитель 1,5, каждый следующий — дополнительный множитель 1,15. Сайт добавляет строки дополнительных котят динамически; VK поддерживает сегмент `доп. котята: Имя [ID], Имя2 [ID]`. Калькулятор прокачки принимает `extra_kittens` из веб-формы, API и VK-команды. Общая выплата сопровождающему не суммирует полную ставку на каждого котёнка: первый подопечный использует базовый коэффициент, второй — множитель 1,5, каждый следующий — дополнительный множитель 1,15. Сайт добавляет строки дополнительных котят динамически; VK поддерживает сегмент `доп. котята: Имя [ID], Имя2 [ID]`.
+9
View File
@@ -276,6 +276,15 @@ class ReportTests(unittest.TestCase):
self.assertEqual(result.points, 7) self.assertEqual(result.points, 7)
self.assertEqual([item["points"] for item in result.resource_points], [3, 4]) 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__": if __name__ == "__main__":
unittest.main() unittest.main()