impr: fallback when no chart data in database

This commit is contained in:
2023-09-23 14:53:04 +08:00
parent 109e635347
commit 0bd709f49e
6 changed files with 77 additions and 25 deletions

View File

@ -96,7 +96,13 @@ class ScoreDelegate(TextSegmentDelegate):
score = self.getScore(index)
chart = self.getChart(index)
if isinstance(score, Score) and isinstance(chart, Chart):
if (
isinstance(score, Score)
and isinstance(chart, Chart)
and chart.notes is not None
and score.pure is not None
and score.far is not None
):
scoreRange = calculate_score_range(chart.notes, score.pure, score.far)
return scoreRange[0] <= score.score <= scoreRange[1]