Skip to content

Commit

Permalink
sort by id if votes are equal
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoalzate committed May 27, 2024
1 parent 2dc3b20 commit b8b678e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/berlin/src/pages/Cycle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,10 @@ function Cycle() {
const votesB = localUserVotes?.find((vote) => vote.optionId === b.id)?.numOfVotes || 0;

if (votesA === votesB) {
return sortByLead(a, b, order);
const idA = a.id.toUpperCase();
const idB = b.id.toUpperCase();

return order === 'desc' ? idB.localeCompare(idA) : idA.localeCompare(idB);
}

return order === 'desc' ? votesB - votesA : votesA - votesB;
Expand Down

0 comments on commit b8b678e

Please sign in to comment.