Skip to content

Commit

Permalink
fix: sort longshanks players by rank
Browse files Browse the repository at this point in the history
  • Loading branch information
sebald committed Sep 18, 2023
1 parent 8c537c3 commit d9274fb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/api/longshanks/[id]/players/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,12 @@ export const GET = async (_: NextRequest, { params }: RouteContext) => {
};
});

players.sort((a, b) => {
if (a.rank.elimination || b.rank.elimination) {
return (a.rank.elimination ?? 1000) - (b.rank.elimination ?? 1000);
}
return a.rank.swiss - b.rank.swiss;
});

return NextResponse.json(players);
};

1 comment on commit d9274fb

@vercel
Copy link

@vercel vercel bot commented on d9274fb Sep 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.