Skip to content

Commit

Permalink
sort by lead 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 3810d96 commit 2dc3b20
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/berlin/src/pages/Cycle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@ function Cycle() {
) => {
const votesA = localUserVotes?.find((vote) => vote.optionId === a.id)?.numOfVotes || 0;
const votesB = localUserVotes?.find((vote) => vote.optionId === b.id)?.numOfVotes || 0;

if (votesA === votesB) {
return sortByLead(a, b, order);
}

return order === 'desc' ? votesB - votesA : votesA - votesB;
};

Expand Down

0 comments on commit 2dc3b20

Please sign in to comment.