From 64e538df4097eb3ae038084c769f1a1a61e11110 Mon Sep 17 00:00:00 2001 From: Shashank Vaishnav Date: Tue, 12 May 2026 11:22:58 +0530 Subject: [PATCH] Fix proposal vote percentage calculation --- pages/proposals/_id/index.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pages/proposals/_id/index.vue b/pages/proposals/_id/index.vue index 73ecbd4..b6653ff 100644 --- a/pages/proposals/_id/index.vue +++ b/pages/proposals/_id/index.vue @@ -427,7 +427,11 @@ export default { } }, votePercentage (vote, proposal) { - return (vote.weight / (proposal.vote_counts[0].value + proposal.vote_counts[1].value + proposal.vote_counts[2].value) * 100).toFixed(2) + const totalVoteWeight = (proposal.vote_counts || []).reduce((total, voteCount) => total + Number(voteCount.value || 0), 0) + if (!totalVoteWeight) { + return '0.00' + } + return (vote.weight / totalVoteWeight * 100).toFixed(2) }, async assignToNextCycle () { if (this.$dao.proposalConfig && this.proposal) {