Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
filter out eliminated vote options for irv
Browse files Browse the repository at this point in the history
  • Loading branch information
jparklev committed May 11, 2020
1 parent e0a5350 commit 40f6b56
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/dai-plugin-governance/src/GovPollingService.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,9 @@ export default class GovPollingService extends PrivateService {
tally.rounds++;

// eliminate the weakest candidate
const [optionToEliminate] = Object.entries(tally.options).reduce(
(prv, cur) => {
const [optionToEliminate] = Object.entries(tally.options)
.filter(([, optionDetails]) => !optionDetails.eliminated)
.reduce((prv, cur) => {
const [, prvVotes] = prv;
const [, curVotes] = cur;
if (
Expand All @@ -178,8 +179,7 @@ export default class GovPollingService extends PrivateService {
)
return cur;
return prv;
}
);
});

tally.options[optionToEliminate].eliminated = true;
tally.options[optionToEliminate].transfer = BigNumber(0);
Expand Down

0 comments on commit 40f6b56

Please sign in to comment.