Needs review
Project:
Decisions
Version:
6.x-1.6
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Mar 2010 at 22:43 UTC
Updated:
29 May 2010 at 18:10 UTC
Jump to comment: Most recent file
I use a selection voting where anonymous users can give a maximum of 3 votes.
I found that on the Votes page all anonymous votes were shown under 1 IP-address.
I changed the $query line in function decisions_votes_tab()
from: 'GROUP BY v.uid'
to: 'GROUP BY v.vote_source'
and now I see different IP-addresses all with a maximum of 3 votes.
As I'm a newbee to drupal: Is this a bug fix or am I missing something and messing up other scenario's?
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 755068.patch | 1.51 KB | floater |
Comments
Comment #1
ezra-g commentedCan you clarify what voting mode you're using, post the unexpected output/data you're seeing and explain what you would expect to see?
Comment #2
floater commentedUsing Decisions - selection I create a test poll with 4 choices and max 2 allowed. I vote several times for choice 1 and 2 and one time for choise 1 and 3, from 2 different IP's.
On the Votes page I see only:
IP2 with votes: Choise 1, Choise 2 and Choise 3 (this IP voted only 1 and 2)
Using the following modification in 'decisions.module':
original line 720:
$query = 'SELECT u.name, v.uid, v.vote_source, GROUP_CONCAT(DISTINCT CONCAT(v.value,"=>",v.tag) ORDER BY v.value) as votes FROM {votingapi_vote} v LEFT JOIN {users} u ON v.uid = u.uid WHERE v.content_id = %d GROUP BY v.uid'. tablesort_sql($header) .'';
modified line 720:
$query = 'SELECT u.name, v.uid, v.vote_source, GROUP_CONCAT(DISTINCT CONCAT(v.value,"=>",v.tag) ORDER BY v.value) as votes FROM {votingapi_vote} v LEFT JOIN {users} u ON v.uid = u.uid WHERE v.content_id = %d GROUP BY v.vote_source'. tablesort_sql($header) .'';
(Changed the group by)
Now I get:
IP1 choise 3, choise 2, choise 1
IP2 choise 2, choise 1
Comment #3
floater commented(I guess I had to change the status?)
Comment #4
ezra-g commentedIt would be really helpful if you could post a screenshot and a patch to help with reviewing this issue.
Comment #5
GigantPlus commentedIt's really a good solution... with a small addition. We must also replace
(DISTINCT v.uid)-->(DISTINCT v.vote_source)in the second line:$query_count = 'SELECT COUNT(DISTINCT v.uid) FROM {votingapi_vote} v LEFT JOIN {users} u ON v.uid = u.uid WHERE v.content_id = %d GROUP BY content_id' . tablesort_sql($header);Complete solution:
$query = 'SELECT u.name, v.uid, v.vote_source, GROUP_CONCAT(DISTINCT CONCAT(v.value,"=>",v.tag) ORDER BY v.value) as votes FROM {votingapi_vote} v LEFT JOIN {users} u ON v.uid = u.uid WHERE v.content_id = %d GROUP BY v.vote_source' . tablesort_sql($header) . '';$query_count = 'SELECT COUNT(DISTINCT v.vote_source) FROM {votingapi_vote} v LEFT JOIN {users} u ON v.uid = u.uid WHERE v.content_id = %d GROUP BY content_id' . tablesort_sql($header);It is working properly!
Comment #6
ezra-g commentedThanks for this suggestion. Marking as NW pending a patch.
Comment #7
floater commentedAttached our combined patch