Skip to content

Commit

Permalink
Update root.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
crqch authored Aug 30, 2024
1 parent ed2c222 commit cb33147
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/server/api/root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const appRouter = createTRPCRouter({
leaderboard.push({...input, ip})

leaderboard = leaderboard.sort((a, b) => a.time - b.time)
const highestScore = leaderboard.filter(s => s.ip === ip)[0]
const highestScore = leaderboard.find(s => s.ip === ip)
if(highestScore === undefined) return [0, "An error occured"];
leaderboard = leaderboard.filter(s => s.ip !== ip)
leaderboard.push(highestScore)
Expand Down

0 comments on commit cb33147

Please sign in to comment.