Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui-ux): remove neutral votes weightage #1740

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
};
}