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 68fa0cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
6 changes: 1 addition & 5 deletions src/pages/governance/_components/VotingResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,7 @@ export function VotingResult({
proposal: GovernanceProposal;
}) {
const minVotes = getMinVotes(proposal);
const { percYes, percNo } = getVotePercentage(
voteCounts.yes,
voteCounts.no,
voteCounts.neutral
);
const { percYes, percNo } = getVotePercentage(voteCounts.yes, voteCounts.no);
const total = new BigNumber(voteCounts.yes)
.plus(voteCounts.no)
.plus(voteCounts.neutral);
Expand Down
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 68fa0cb

Please sign in to comment.