fix: preserve independence for each kitten

This commit is contained in:
nyan404 committed 2026-08-25 21:36:03 +03:00
1 parent 7018bc0398
commit fa61d11912
8 files changed
+74 -74

No files matched your search

-5
View File
@@ -115,8 +115,6 @@ class CoachingSession:
raise ValueError("ID участников одного захода не должны повторяться")
statuses = (self.kitten_independence,) + tuple(independence for _, _, independence in self.extra_kittens)
nonself_count = sum(status == "несамостоятельно" for status in statuses)
if self.skill == "ЗУ" and any(s != "самостоятельно" for s in statuses):
raise ValueError("Для ЗУ все котята должны быть самостоятельными")
if self.skill == "ЛУ" and nonself_count > 1:
raise ValueError("Для ЛУ допускается только один несамостоятельный котёнок")
@@ -174,9 +172,6 @@ def calculate_goal(
raise ValueError(f"Продолжительность захода должна быть целым числом от 1 до {MAX_GOAL_MINUTES_PER_SESSION} минут")
if isinstance(kitten_count, bool) or not isinstance(kitten_count, int) or not 0 < kitten_count <= MAX_GOAL_KITTENS:
raise ValueError(f"Количество котят должно быть целым числом от 1 до {MAX_GOAL_KITTENS}")
if skill == "ЗУ" and kitten_independence != "самостоятельно":
raise ValueError("Для ЗУ котёнок должен быть самостоятельным")
ward_multiplier = 1.0 if kitten_count == 1 else 1.5 * (1.15 ** (kitten_count - 2))
nonself_bonus = minutes_per_session * 0.5 / 5 if kitten_independence == "несамостоятельно" else 0
points_per_session = _points(minutes_per_session * ward_multiplier / 5 + nonself_bonus)