Hack Forums
[Feedback] HF polls showing incorrect poll results? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Hack Forums Official Information (https://hackforums.net/forumdisplay.php?fid=1)
+--- Forum: Site News (https://hackforums.net/forumdisplay.php?fid=2)
+--- Thread: [Feedback] HF polls showing incorrect poll results? (/showthread.php?tid=5468516)



HF polls showing incorrect poll results? - Wakka - Nov 19, 2016

So I made a thread earlier on which web browser members preffered... Now if you add up all the users who voted for google chrome it doesn't tally up with the result on the right... The result should say 17 not 15.

[Image: 0d17f7de89085f8b79635daf3ca11300.png]

Dunno whether this is a known bug or not, couldn't find anything when searching.


* - minimalist - Nov 19, 2016

"This is an issue caused by MyBB not having a normalized database structure. They most likely do it to make it faster to get the numbers. That also means that the cached numbers and the actual votes don't add up on larger boards.
Mentors use this userscript to count the actual votes on the MotM poll, which will look at the usernames and change the numbers.
"
source: https://hackforums.net/showthread.php?tid=4936464&pid=47329450#pid47329450

Attached userscript:
Code
// ==UserScript==
// @name      Hack Forums - Poll Counter
// @namespace    Xerotic
// @description  Counts polls properly when they are public (or mod of the section)
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
// @include      *hackforums.net/polls.php*
// @grant      none
// @version      1.0
// ==/UserScript==

var total_count = 0;

$('.quick_keys').first().find('tr').each(function() {
if(!$(this).children().first().hasClass('thread')) {
  if($(this).children().first().hasClass('tfoot')) {
   $(this).children().first().next().html('<strong>' + total_count + ' votes</strong>');
  } else {
   $(this).children().first().next().next().html($(this).children().first().next().​find('a').length);
   total_count += parseInt($(this).children().first().next().find('a').length);
  }
}
});



* - Wakka - Nov 19, 2016

Thanks minimalist, can always count on you for a solid answer to any questions in this section xD