Closed (fixed)
Project:
Decisions
Version:
6.x-1.7
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 May 2010 at 23:49 UTC
Updated:
27 May 2010 at 04:38 UTC
I have a decisions node displayed in a panel pane on the front page of a site, and when the results are displayed, they show one vote (see attached image), regardless of how many votes have actually been cast (51 in this particular case, as seen in the votingapi_vote table). The AJAX voting option is enabled. It can be seen at http://www.canadianblackbook.com/news-reviews.
I'm still investigating, but I wanted to get this out there in case anyone knew the answer off the top of their heads.
Thanks.
| Comment | File | Size | Author |
|---|---|---|---|
| decision_one_vote.gif | 11.34 KB | wonder95 |
Comments
Comment #1
wonder95 commentedThe code in question is in selection_decisions_view_results($node, $teaser, $page, $this_vote = array()), and after stepping through it, I'm befuddled as to how it works in the first place. The issue is that it never even touches the variable data that holds the vote counts.
Here's the code in question:
When $results is filled (from the call to votingapi_select_results(array('content_id' => $node->nid, 'content_type' => 'decisions'));), it is an array with one array for each option in the poll. Each option contains a tag value that is the total of votes (which I verified with a query in votingapi_vote and also looking at the votingapi_cache table), so that when looping through $results with
$result['value'] contains the total votes for that option. However, that value is never accessed in the ensuing code. Instead, it sets $voteval as the item number of the option in the poll (1 - 5 in this case), and then sets $vote[$voteval] to the item number instead of the actual total number of votes. Then, it looks for a match for $voteval in $votes and sets $votes[$voteval] to 0 if there is no match in $votes (which there won't be since $votes was just initialized a few lines above). After that, it's increased to 1 (I'm not sure why), and that result is what's displayed. At no point is the actual vote could accessed.
I'm working on a patch and will post it as soon as I have it.
Comment #2
wonder95 commentedAAAARRGGGGGHHHHH!! After all that work figuring this out, I realized I had an old HEAD version installed, and that this is correct in 6.x-1.7.