Skip to content

Commit

Permalink
fix: rank 중복 제거 (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
student079 authored Dec 3, 2024
1 parent d7ef0ea commit 2a552c7
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions be/gameServer/src/modules/games/games-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,15 @@ export function removePlayerFromGame(
gameData: GameDataDto,
playerNickname: string,
): void {
gameData.alivePlayers = gameData.alivePlayers.filter(
(player: string) => player !== playerNickname,
);

gameData.rank.unshift(playerNickname);
if (gameData.alivePlayers.includes(playerNickname)) {
gameData.alivePlayers = gameData.alivePlayers.filter(
(player: string) => player !== playerNickname,
);

if (!gameData.rank.includes(playerNickname)) {
gameData.rank.unshift(playerNickname);
}
}
}

export function noteToNumber(note: string): number {
Expand Down

0 comments on commit 2a552c7

Please sign in to comment.