lesterchan / wp-polls

Adds an AJAX poll system to your WordPress blog. You can also easily add a poll into your WordPress's blog post/page.
https://wordpress.org/plugins/wp-polls/
93 stars 78 forks source link

Fix percentage calculation error #73

Closed ghost closed 7 years ago

ghost commented 8 years ago

Fix percentage calculation error when multiple choices is allowed.

lesterchan commented 8 years ago

It is not an error, see https://github.com/lesterchan/wp-polls/pull/29

ghost commented 8 years ago

@lesterchan OK but I think if an option has a vote count which is larger than the total voter count, the percentage for it will be more than 100% which I think it's strange.

ghost commented 8 years ago

@lesterchan And the percentage bar will also break the div container for it has a width value more than 100% 1

lesterchan commented 8 years ago

I am aware of the more than 100% bar. But I am not sure if having votes/total votes is a better result than using total voters. I will leave this open for more discussion.

ghost commented 8 years ago

@lesterchan Firstly, I've to say the percentage will reach more than 100% only when I manually change the vote count in the background, so it won't happen if all the votes are voted by real visitors. Sorry for this. So now I think it's hard to say whose calculation method is right, so I did some tests with some popular forums. Here's the screenshots as a reference.

(All the polls below are only with one voter and two votes)

Baidu Tieba

(One of the largest Chinese communities) 1

Discuz! X3.2

(A famous Chinese PHP forum solution) 2

PHPWind 9.0.1

(Another famous Chinese PHP forum solution) 3

Xenforo 1.5.8

4

IPS 4.1.7

5

VBB 5.0.5

6

lesterchan commented 8 years ago

Hmm 4 forums divided by votes, 2 forums divided by voters

Just for completness, here is WP-Polls one which is divided by voters. screen shot 2016-07-13 at 10 49 29