From 68fa0cbbd47a0caf13013977f0360512fd1ff747 Mon Sep 17 00:00:00 2001 From: Jordan Kee Date: Fri, 3 Mar 2023 18:40:27 +0800 Subject: [PATCH] Remove percNeutral --- src/pages/governance/_components/VotingResult.tsx | 6 +----- src/pages/governance/shared/getTotalVotes.ts | 11 ++--------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/pages/governance/_components/VotingResult.tsx b/src/pages/governance/_components/VotingResult.tsx index 0f6a5efb6..69867145f 100644 --- a/src/pages/governance/_components/VotingResult.tsx +++ b/src/pages/governance/_components/VotingResult.tsx @@ -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); diff --git a/src/pages/governance/shared/getTotalVotes.ts b/src/pages/governance/shared/getTotalVotes.ts index 6dcb8c979..cfbc60861 100644 --- a/src/pages/governance/shared/getTotalVotes.ts +++ b/src/pages/governance/shared/getTotalVotes.ts @@ -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, }; }