From b0ac60b2c98f535f552531b08d91e8220fe5aca1 Mon Sep 17 00:00:00 2001 From: Globalpropertyguy <249839719+Globalpropertyguy@users.noreply.github.com> Date: Sun, 10 May 2026 22:22:31 -0500 Subject: [PATCH] fix: handle missing proposal vote counts --- pages/proposals/_id/index.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pages/proposals/_id/index.vue b/pages/proposals/_id/index.vue index 73ecbd4..cff99d4 100644 --- a/pages/proposals/_id/index.vue +++ b/pages/proposals/_id/index.vue @@ -427,7 +427,14 @@ 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 (Number(vote.weight || 0) / totalVoteWeight * 100).toFixed(2) }, async assignToNextCycle () { if (this.$dao.proposalConfig && this.proposal) {