Skip to content

Commit

Permalink
fix: failed scores seem to have urls now (#215)
Browse files Browse the repository at this point in the history
* fix: failed scores seem to have urls now

* feat: update handling for score urls
  • Loading branch information
NiceAesth authored Feb 9, 2024
1 parent f5e8536 commit 5155ac4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
13 changes: 7 additions & 6 deletions aiosu/models/lazer.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,14 @@ def score_url(self) -> Optional[str]:
:return: Link to the score on the osu! website
:rtype: Optional[str]
"""
if (not self.id and not self.best_id) or not self.passed:
if not self.id:
return None
return (
f"https://osu.ppy.sh/scores/{self.id}"
if self.type == "solo_score"
else f"https://osu.ppy.sh/scores/{self.mode.name_api}/{self.best_id}"
)
if self.type == "solo_score":
return f"https://osu.ppy.sh/scores/{self.id}"

if not self.best_id: # Legacy URL format
return None
return f"https://osu.ppy.sh/scores/{self.mode.name_api}/{self.best_id}"

@property
def replay_url(self) -> Optional[str]:
Expand Down
13 changes: 7 additions & 6 deletions aiosu/models/score.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,14 @@ def score_url(self) -> Optional[str]:
:return: Link to the score on the osu! website
:rtype: Optional[str]
"""
if (not self.id and not self.best_id) or not self.passed:
if not self.id:
return None
return (
f"https://osu.ppy.sh/scores/{self.id}"
if self.type == "solo_score"
else f"https://osu.ppy.sh/scores/{self.mode.name_api}/{self.best_id}"
)
if self.type == "solo_score":
return f"https://osu.ppy.sh/scores/{self.id}"

if not self.best_id or not self.passed: # Legacy URL format
return None
return f"https://osu.ppy.sh/scores/{self.mode.name_api}/{self.best_id}"

@property
def replay_url(self) -> Optional[str]:
Expand Down

0 comments on commit 5155ac4

Please sign in to comment.