Skip to content

Commit

Permalink
Remove percNeutral
Browse files Browse the repository at this point in the history
  • Loading branch information
jordankzf committed Mar 3, 2023
1 parent 1490776 commit ae1286b
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/pages/governance/shared/getTotalVotes.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
import BigNumber from "bignumber.js";

export function getVotePercentage(
numYes: number,
numNo: number,
numNeutral: number
) {
// TODO: to remove neutral votes from total votes tabulation count after bc released fix for neutral vote tabulation
const totalVotes = numYes + numNo + numNeutral;
export function getVotePercentage(numYes: number, numNo: number) {
const totalVotes = numYes + numNo;
const percYes = BigNumber(numYes).div(totalVotes).multipliedBy(100);
const percNo = BigNumber(numNo).div(totalVotes).multipliedBy(100);
const percNeutral = BigNumber(numNeutral).div(totalVotes).multipliedBy(100);

return {
percYes: percYes.isNaN() ? BigNumber(0) : percYes,
percNo: percNo.isNaN() ? BigNumber(0) : percNo,
percNeutral: percNeutral.isNaN() ? BigNumber(0) : percNeutral,
};
}

0 comments on commit ae1286b

Please sign in to comment.