Admin fixes
This commit is contained in:
1 parent
6db39f0d51
commit
a7f6fc0fc8
18 files changed
+285
-59
No files matched your search
+13
-6
@@ -86,6 +86,8 @@ class CoachingResult:
|
||||
minutes: int
|
||||
escort_points: float | int
|
||||
kitten_points: float | int
|
||||
kitten_count: int = 1
|
||||
escort_multiplier: float = 1.0
|
||||
|
||||
|
||||
def calculate_coaching(session: CoachingSession) -> CoachingResult:
|
||||
@@ -93,15 +95,20 @@ def calculate_coaching(session: CoachingSession) -> CoachingResult:
|
||||
if minutes <= 0:
|
||||
raise ValueError("Продолжительность захода должна быть больше нуля")
|
||||
|
||||
escort_multiplier = 1.5 if session.kitten_independence == "несамостоятельно" else 1.0
|
||||
for _, _, independence in session.extra_kittens:
|
||||
if independence == "несамостоятельно":
|
||||
escort_multiplier += 0.5
|
||||
independence_multiplier = 1.5 if session.kitten_independence == "несамостоятельно" else 1.0
|
||||
kitten_count = 1 + len(session.extra_kittens)
|
||||
# Several wards share one report: the second ward pays 1.5x, and each
|
||||
# following ward adds a further 1.15x multiplier instead of another full
|
||||
# base payout.
|
||||
ward_multiplier = 1.0 if kitten_count == 1 else 1.5 * (1.15 ** (kitten_count - 2))
|
||||
escort_multiplier = independence_multiplier * ward_multiplier
|
||||
|
||||
return CoachingResult(
|
||||
minutes=minutes,
|
||||
escort_points=_points(minutes * escort_multiplier / 5),
|
||||
kitten_points=_points(minutes * 2 / 5),
|
||||
kitten_count=kitten_count,
|
||||
escort_multiplier=round(escort_multiplier, 4),
|
||||
)
|
||||
|
||||
|
||||
@@ -145,8 +152,8 @@ class InspectionReport:
|
||||
if isinstance(self.inspections, bool) or not isinstance(self.inspections, int) or self.inspections < 0:
|
||||
raise ValueError("Количество осмотров должно быть неотрицательным целым")
|
||||
for name, amount in self.resources:
|
||||
if not name.strip() or not isinstance(amount, int):
|
||||
raise ValueError("Ресурс должен иметь название и целое количество")
|
||||
if not name.strip() or not isinstance(amount, int) or amount < 0:
|
||||
raise ValueError("Ресурс должен иметь название и неотрицательное целое количество")
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
||||
Reference in new issue
Block a user