Skip to content

fix: handle missing proposal vote counts#222

Open
Globalpropertyguy wants to merge 1 commit into
effectai:mainfrom
Globalpropertyguy:fix/proposal-vote-percentage-missing-counts
Open

fix: handle missing proposal vote counts#222
Globalpropertyguy wants to merge 1 commit into
effectai:mainfrom
Globalpropertyguy:fix/proposal-vote-percentage-missing-counts

Conversation

@Globalpropertyguy
Copy link
Copy Markdown

Summary

  • Fix votePercentage when older proposals omit one or more vote-count rows
  • Sum the vote-count rows returned by the chain instead of assuming indexes 0, 1, and 2 always exist
  • Return 0.00 safely when no vote weight is available

Fixes #184.

Verification

  • git diff --check
  • Ran a Node smoke check using the proposal Stake Age updates #1 vote-count shape from the issue: [{ key: 0, value: 58 }, { key: 1, value: 164 }] -> total 222, yes percentage 73.87

Notes

  • I did not run the project lint/build because this repo pins Node 14/npm 6 in package.json, while the available local environment is Node 24/npm 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