Differences between poll results in 2.3 vs. 3.7

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • StephenKay
    Senior Member
    • Apr 2003
    • 437

    Differences between poll results in 2.3 vs. 3.7

    Can someone explain to me what is going on with the math in this poll?

    Here is the publicly functioning 2.3 version:



    Here is a non-functioning copy of the forum that is being updated to 3.7



    As you can see, the percentages are completely different for the 3.7 version, and indeed, would equal much more than 100% if added up.

    And the old version has a total at the bottom, showing 100% and 46 votes. What happened to the totals in the new version? Not to mention that the old total of 46 votes is not correct if counting the multiple choices; it's 46 votes total but does not reflect accurately the total number of choices ticked off. However, it looks like the percentages total up correctly.

    Even if it's a multiple choice poll, the new math doesn't seem to make sense! Shouldn't it total 100%? Otherwise, what sense do the numbers make?
  • Steve Machol
    Former Customer Support Manager
    • Jul 2000
    • 154488

    #2
    The second one is a multiple choice poll and the results will not necessarily add up to 100%
    Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
    Change CKEditor Colors to Match Style (for 4.1.4 and above)

    Steve Machol Photography


    Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


    Comment

    • StephenKay
      Senior Member
      • Apr 2003
      • 437

      #3
      Yes, but that's my point. What sense does this make, and why was it changed from 2.3 (where it used to make sense)?

      Comment

      • Steve Machol
        Former Customer Support Manager
        • Jul 2000
        • 154488

        #4
        The percentages have always been different between single choice and multiple choice polls.
        Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
        Change CKEditor Colors to Match Style (for 4.1.4 and above)

        Steve Machol Photography


        Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


        Comment

        • StephenKay
          Senior Member
          • Apr 2003
          • 437

          #5
          Sorry, my 2.3 forum example above shows that this was not the case. Multiple choice poll results were calculated the same as single choice polls.

          But rather than complain about it, I fixed it.

          In your 3.7 code, if the poll is multiple choice, you are dividing the number of votes by the number of voters (wrong), rather than dividing the number of votes by the total votes (right). Since in a multiple choice poll, the number of votes can be greater than the total number of voters, this produces results that make no sense. Examination of the 2.3.0 code shows that this was changed. Example:

          Code:
          Number of voters = 10
          Multiple choice poll, 20 choices selected total
          
                          3.7.0    2.3.0
          Choice A   10    100%      50%
          Choice B   6      60%      30%
          Choice C   4      40%      20%
                    -----------------------
                           200%     100%
          For anyone who cares to have percentages that make sense (and total 100%), put this in a plug-in located in two places:

          hook: poll_results_bit
          hook: showthread_polloption
          Code:
          if (($option['percent'] > 0) && ($pollinfo['multiple']))
          {
              $option['percent'] = vb_number_format(($options['votes'] < $pollinfo['numbervotes']) ? $option['votes'] / $pollinfo['numbervotes'] * 100 : 100, 2);
          }
          Last edited by StephenKay; Fri 23 May '08, 12:03pm.

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...