Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-16792

Polls are calculating the win percents WRONG and sometimes the winner is wrong too!!!



    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • Other
    • None
    • phpBB 3.3 demo (on 6/6/21)


      Polls that allow the user to vote for more than one item/option are calculating the win percents (the results) WRONG. And the item with the highest win percent isn't even always the correct winner either – sometimes it is and sometimes it isn't depending on how people voted!

      Currently, for each item/option/choice in the poll, you are calculating the item's percent by dividing it's number of votes by the total number of votes. But that is wrong, you should calculate each item's percent by dividing it's number of votes by the total number of VOTERS.

      Wrongly dividing by the number of votes does not even make any sense. There is NEVER a reason to do that. That is not how elections work. You always want to show the percent of VOTERS that voted for each item, not the percent of votes, because in elections, the term "vote" always means the same thing as a VOTER, but whoever originally programmed this didn't realize this and was confused.

      For example, let's say you have a poll "Do you want ketchup or mustard on your french fries?". The two items/options to choose from are "ketchup" and "mustard". There are two voters. Voter A chooses ketchup, and voter B chooses both ketchup & mustard.
      So, ketchup will show 2 votes, divided by 3 total votes = 66.6% which is WRONG. Ketchup should show 2 votes, divided by 2 VOTERS = 100%.
      And mustard will show 1 vote, divided by 3 total votes = 33.3% which is WRONG. Mustard should show 1 vote, divided by 2 VOTERS = 50%.

      By wrongly dividing by votes, you are taking Voter B's vote for Ketchup and SPLITTING IT UP into halves, so Ketchup only gets HALF a vote and mustard only gets HALF a vote, but Voter B should get one FULL vote for ketchup, and one FULL vote for mustard. (Since voter A only voted for one item, their vote was not split up, so their ketchup vote counted TWICE as much as voter B's vote, and that's obviously not fair or correct.)

      You may be thinking, "But what if you have 10 items/options and you want people to pick 2 winners out of those 10 items, so you set the number of "options per user" to 2.". That's not how elections work though – you ALWAYS either want to allow people to be able to pick only 1 option, or any number of options (up to the maximum number of options), and you still divide by the total number of voters. So in this case where you wanted the top 2 winners, they are simply the 1st-place winner and the 2nd-place winner. That's how elections work.

      So in summary, please change the code for the polls so that:
      1) Each item divides it's number of votes by the total number of VOTERS (not votes).
      2) And, show the total number of VOTERS at the bottom of the poll (not the "total votes").
      3) And, ideally, when creating the poll, change the "options per user" so that it only allows the poll creator to allow users to choose 1 option or multiple options (nothing in between).


      BTW it appears alot of other forum software is also calculating poll winners incorrectly, so if you fix your polls, you may be the only/first forum that does it correctly, making your forum better than others.




            Unassigned Unassigned
            founder1 founder1 [X] (Inactive)
            0 Vote for this issue
            3 Start watching this issue