Skip to content

Commit

Permalink
Change Player.uid to Player.id
Browse files Browse the repository at this point in the history
  • Loading branch information
Rian8337 committed Nov 8, 2024
1 parent bad073e commit adb5ad2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 5 additions & 5 deletions packages/osu-droid-utilities/src/Player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { APIPlayer } from "./APIPlayer";
*/
export class Player {
/**
* The uid of the player.
* The user ID of the player.
*/
uid = 0;
id = 0;

/**
* The username of the player.
Expand All @@ -20,7 +20,7 @@ export class Player {
* The avatar URL of the player.
*/
get avatarUrl(): string {
return `https://osudroid.moe/user/avatar?id=${this.uid}`;
return `https://osudroid.moe/user/avatar?id=${this.id}`;
}

/**
Expand Down Expand Up @@ -59,7 +59,7 @@ export class Player {
readonly recentPlays: Score[] = [];

constructor(apiPlayer: APIPlayer) {
this.uid = apiPlayer.id;
this.id = apiPlayer.id;
this.username = apiPlayer.username;
this.score = apiPlayer.score;
this.playCount = apiPlayer.playcount;
Expand Down Expand Up @@ -113,6 +113,6 @@ export class Player {
* Returns a string representative of the class.
*/
toString(): string {
return `Username: ${this.username}\nUID: ${this.uid}\nRank: ${this.rank}\nScore: ${this.score}\nPlay count: ${this.playCount}`;
return `Username: ${this.username}\nUID: ${this.id}\nRank: ${this.rank}\nScore: ${this.score}\nPlay count: ${this.playCount}`;
}
}
4 changes: 1 addition & 3 deletions packages/osu-droid-utilities/tests/Player.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const apiMock: APIPlayer = {
username: "Rian8337",
filename: "Mage - The Words I Never Said (Strategas) [Regret]",
score: 67030952,
scoreid: 18535463,
combo: 2376,
mark: "S",
mode: "|",
Expand All @@ -37,7 +36,6 @@ const apiMock: APIPlayer = {
filename:
"Nogizaka46 - Yubi Bouenkyou ~Anime-ban~ (Nevo) [~A r M i N s Adventure~]",
score: 3047526,
scoreid: 5517583,
combo: 454,
mark: "SH",
mode: "hc|",
Expand All @@ -58,10 +56,10 @@ test("Test fill information", () => {

expect(player.accuracy).toBe(97.64);
expect(player.avatarUrl).toBe("https://osudroid.moe/user/avatar?id=51076");
expect(player.id).toBe(51076);
expect(player.location).toBe("ID");
expect(player.playCount).toBe(746);
expect(player.recentPlays.length).toBe(2);
expect(player.score).toBe(19913797741);
expect(player.uid).toBe(51076);
expect(player.username).toBe("Rian8337");
});

0 comments on commit adb5ad2

Please sign in to comment.