Fix poll percentage bug
Summary
Sometimes polls in Soapbox display batshit numbers that make no sense. This is because it divides by voters_count
and not votes_count
.
When you visit the polls endpoint, it sometimes returns a lower number of voters than votes. Example: https://iddqd.social/api/v1/polls/50338112
{
"emojis": [],
"expired": true,
"expires_at": "2024-01-11T04:23:07.000Z",
"id": "50338112",
"multiple": false,
"options": [
{
"title": "Yes",
"votes_count": 10
},
{
"title": "No",
"votes_count": 3
}
],
"pleroma": {
"non_anonymous": false
},
"voters_count": 7,
"votes_count": 13
}
See results below.
Screenshots (if appropriate):
10/7 = 1.43, hence this (incorrect):
10/13=0.77, hence this (correct):