Skip to content

Commit

Permalink
fix: re-add pass validator (#213)
Browse files Browse the repository at this point in the history
api still does not return F ranks
  • Loading branch information
NiceAesth authored Jan 30, 2024
1 parent bfe1d3a commit 49ec318
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions aiosu/models/lazer.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,10 @@ def mode(self) -> Gamemode:
@cached_property
def mods_str(self) -> str:
return "".join(str(mod) for mod in self.mods)

@model_validator(mode="before")
@classmethod
def _fail_rank(cls, values: dict[str, object]) -> dict[str, object]:
if not values["passed"]:
values["rank"] = "F"
return values
7 changes: 7 additions & 0 deletions aiosu/models/score.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,13 @@ def completion(self) -> Optional[float]:

return calculate_score_completion(self.mode, self.statistics, self.beatmap)

@model_validator(mode="before")
@classmethod
def _fail_rank(cls, values: dict[str, object]) -> dict[str, object]:
if not values["passed"]:
values["rank"] = "F"
return values

async def request_beatmap(self, client: v1.Client) -> None:
r"""For v1 Scores: requests the beatmap from the API and sets it.
Expand Down

0 comments on commit 49ec318

Please sign in to comment.