From 2dc3b20a657f5b3063b9fb44f89415e0009ae866 Mon Sep 17 00:00:00 2001 From: Diego Alzate Date: Mon, 27 May 2024 23:31:37 +0200 Subject: [PATCH] sort by lead if votes are equal --- packages/berlin/src/pages/Cycle.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/berlin/src/pages/Cycle.tsx b/packages/berlin/src/pages/Cycle.tsx index 76cab748..9c6e1df6 100644 --- a/packages/berlin/src/pages/Cycle.tsx +++ b/packages/berlin/src/pages/Cycle.tsx @@ -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; };