[codex] Fix sparse proposal vote counts#224
Open
Cosmhyccc wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
keyvalue instead of assuming array indexes 0, 1, and 2 always exist.Why
Proposal #1 has sparse historical
vote_countsdata: 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.00whenever 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)[{ key: 0, value: 58 }, { key: 1, value: 164 }]NODE_OPTIONS=--openssl-legacy-provider; JS compilation started, but the build is blocked by existingnode-sass@4.14.1support limits on macOS arm64 / modern Node. The repo declares Node 14/npm 6, and Node 14 arm64 was not available throughnpx node@14.21.3on this machine.