Skip to content

[codex] Fix sparse proposal vote counts#224

Open
Cosmhyccc wants to merge 1 commit into
effectai:mainfrom
Cosmhyccc:codex/fix-sparse-vote-counts
Open

[codex] Fix sparse proposal vote counts#224
Cosmhyccc wants to merge 1 commit into
effectai:mainfrom
Cosmhyccc:codex/fix-sparse-vote-counts

Conversation

@Cosmhyccc
Copy link
Copy Markdown

Summary

  • Read proposal vote counts by their key value instead of assuming array indexes 0, 1, and 2 always exist.
  • Treat missing vote buckets as zero so historical proposals can still show their actual YES/NO comparison and vote percentages.
  • Keep current behavior for proposals that already include all vote-count buckets.

Why

Proposal #1 has sparse historical vote_counts data: it includes ABSTAIN and YES counts, but no NO row. The existing frontend assumes all three vote types are present by array index, which breaks the vote display for that proposal.

This is a small alternative to #221. That PR avoids the null access, but returns 0.00 whenever any bucket is missing; this version keeps the historical YES/ABSTAIN result visible by summing the buckets that actually exist.

Fixes #184

Verification

  • git diff --check
  • ./node_modules/.bin/eslint components/Proposals.vue pages/proposals/_id/index.vue (0 errors; existing warnings remain)
  • Sparse vote-count smoke test for proposal data shaped like [{ key: 0, value: 58 }, { key: 1, value: 164 }]
  • Attempted Nuxt build with Node 20 and NODE_OPTIONS=--openssl-legacy-provider; JS compilation started, but the build is blocked by existing node-sass@4.14.1 support limits on macOS arm64 / modern Node. The repo declares Node 14/npm 6, and Node 14 arm64 was not available through npx node@14.21.3 on this machine.

@Cosmhyccc Cosmhyccc marked this pull request as ready for review May 12, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

First proposal doesn't show votes

1 participant