Skip to content

Commit

Permalink
Avoid sleeping on abstain votes
Browse files Browse the repository at this point in the history
  • Loading branch information
francojreyes committed Oct 1, 2024
1 parent a6e3444 commit efb5879
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,20 @@ function App() {

const initialiseRound = async () => {
for (let i = 0; i < init.votes.length; i++) {
setDistribution(distribution => {
const vote = cloneDeep(init.votes[i]);
const newDistribution = cloneDeep(distribution);
while (vote.length && eliminated.includes(vote[0])) {
vote.shift();
}
if (vote.length && vote[0] != NONE) {
const vote = cloneDeep(init.votes[i]);
while (vote.length && eliminated.includes(vote[0])) {
vote.shift();
}

if (vote.length && vote[0] != NONE) {
setDistribution(distribution => {
const newDistribution = cloneDeep(distribution);
newDistribution[vote[0]].push(vote);
}
return newDistribution;
});
return newDistribution;
});

await sleep(speed);
await sleep(speed);
}
}
};

Expand Down

0 comments on commit efb5879

Please sign in to comment.