From ec7e7f763dfdbae413e47d5be9f9bd10216ed9ae Mon Sep 17 00:00:00 2001 From: nevimer <77420409+nevimer@users.noreply.github.com> Date: Thu, 11 Jun 2026 23:30:13 -0400 Subject: [PATCH] experimental map vote fix --- tgui/packages/tgui/interfaces/VotePanel.tsx | 35 ++++++--------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/tgui/packages/tgui/interfaces/VotePanel.tsx b/tgui/packages/tgui/interfaces/VotePanel.tsx index 4b4ca56bf69..60615b4505f 100644 --- a/tgui/packages/tgui/interfaces/VotePanel.tsx +++ b/tgui/packages/tgui/interfaces/VotePanel.tsx @@ -357,36 +357,21 @@ const ChoicesPanel = (props) => { // Function to handle vote click const handleVoteClick = () => { if (currentRank > 0) { - // Remove this rank and shift others up - const newRanks: Record = {}; - Object.entries(userRanks).forEach( - ([name, rank]: [string, number]) => { - if (name === choice.name) { - return; // Skip this one as we're removing it - } - if (rank > currentRank) { - newRanks[name] = rank - 1; // Shift up - } else { - newRanks[name] = rank; // Keep same - } - }, - ); - // Send all rank updates - Object.entries(newRanks).forEach( - ([name, newRank]: [string, number]) => { - act('voteRanked', { - voteOption: name, - voteRank: newRank, - }); - }, - ); - // Remove this rank + // First zero out the removed choice, then shift others act('voteRanked', { voteOption: choice.name, voteRank: 0, }); + Object.entries(userRanks).forEach(([name, rank]: [string, number]) => { + if (name === choice.name) return; + if (rank > currentRank) { + act('voteRanked', { + voteOption: name, + voteRank: rank - 1, + }); + } + }); } else { - // Add as next rank act('voteRanked', { voteOption: choice.name, voteRank: maxRank + 1,