fix: round goal sessions up
This commit is contained in:
1 parent
d3e3a4802c
commit
8e7fa97f27
3 files changed
+13
-2
No files matched your search
+1
-1
@@ -27,7 +27,7 @@ class ApiError(ValueError):
|
||||
|
||||
# Лениво загружаемые синглотоны
|
||||
_IDENTITY_DIRECTORY: IdentityDirectory | None = None
|
||||
_CALUCALUTION_STORE: CalculationStore | None = None
|
||||
_CALCULATION_STORE: CalculationStore | None = None
|
||||
|
||||
|
||||
def _identity_directory() -> IdentityDirectory:
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@ from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from difflib import SequenceMatcher
|
||||
from math import ceil
|
||||
import re
|
||||
from typing import Literal
|
||||
|
||||
@@ -150,7 +151,7 @@ def calculate_goal(
|
||||
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)
|
||||
remaining = _points(max(target_points - current_points, 0))
|
||||
sessions = 0 if remaining == 0 else int(-(-remaining / points_per_session))
|
||||
sessions = 0 if remaining == 0 else ceil(remaining / points_per_session)
|
||||
total_minutes = sessions * minutes_per_session
|
||||
total_hours_value = total_minutes / 60
|
||||
total_hours = int(total_hours_value) if total_hours_value.is_integer() else round(total_hours_value, 2)
|
||||
|
||||
Reference in new issue
Block a user