fix(statistics): run recalculate independently

This commit is contained in:
MingxuanGame
2025-08-19 13:45:12 +00:00
parent 65bd7ca7d0
commit ce756c354b
3 changed files with 16 additions and 6 deletions

View File

@@ -537,7 +537,9 @@ def calculate_playtime(score: Score, beatmap_length: int) -> tuple[int, bool]:
+ (score.nsmall_tick_hit or 0)
)
total_obj = 0
for statistics, count in score.maximum_statistics.items():
for statistics, count in (
score.maximum_statistics.items() if score.maximum_statistics else {}
):
if not isinstance(statistics, HitResult):
statistics = HitResult(statistics)
if statistics.is_scorable():

View File

@@ -10,7 +10,6 @@ scheduler: AsyncIOScheduler | None = None
def init_scheduler():
global scheduler
scheduler = AsyncIOScheduler(timezone=UTC)
scheduler.start()
def get_scheduler() -> AsyncIOScheduler:
@@ -20,6 +19,12 @@ def get_scheduler() -> AsyncIOScheduler:
return scheduler # pyright: ignore[reportReturnType]
def start_scheduler():
global scheduler
if scheduler is not None:
scheduler.start()
def stop_scheduler():
global scheduler
if scheduler: