Skip to content

Commit

Permalink
feat: update handling for score urls
Browse files Browse the repository at this point in the history
  • Loading branch information
NiceAesth committed Feb 9, 2024
1 parent b198d74 commit 904dc5a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
11 changes: 6 additions & 5 deletions aiosu/models/lazer.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,12 @@ def score_url(self) -> Optional[str]:
"""
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
11 changes: 6 additions & 5 deletions aiosu/models/score.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,12 @@ def score_url(self) -> Optional[str]:
"""
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 904dc5a

Please sign in to comment.