Skip to content

Commit

Permalink
Fix jank round 2 (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChewingGlass authored Jan 20, 2024
1 parent 996c340 commit 1059bf3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pages/[network]/proposals/[proposalKey].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@ const VoteDetailsPage = ({
...r,
index,
percent: totalVotes?.isZero()
? 100 / choices.length
: (BigInt(r.weight.toString()) / BigInt(totalVotes.toString()) * BigInt(100)),
? 100 / proposal?.choices.length
: // Calculate with 4 decimals of precision
r.weight.mul(new BN(10000)).div(totalVotes).toNumber() *
(100 / 10000),
}));
return { results, totalVotes };
}, [choices]);
Expand Down

0 comments on commit 1059bf3

Please sign in to comment.