cannot see all results

igorik - January 30, 2008 - 01:05
Project:Advanced Poll
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

Hi

I can't see all poll results, I can see 10 results (tab "results" on poll node), and if i change sorting from top to bottom, I can see other 10 results (from bottom), not more.
So when my poll has 50 voters, I can't see 30 of them.
I suppose to show all poll results with paging.

thanks
Igorik
http://www.somvprahe.sk

#1

igorik - February 26, 2008 - 04:55
Category:feature request» bug report

Hi
I redeclare this feature request as a bug.
On page with votes for some poll is written: This table lists all the recorded votes for this poll...

But sql query in advpoll.module has only 20 results and no paging.

$result = pager_query("SELECT v.uid, v.hostname, v.timestamp, u.name FROM {votingapi_vote} v LEFT JOIN {users} u ON v.uid = u.uid WHERE v.content_type = 'advpoll' AND v.content_id = %d GROUP BY v.uid, v.hostname, v.timestamp". tablesort_sql($header), 20, 0, NULL, $node->nid);

So probably there is needed to add input into admin poll setting how many results he want on page and change it in query into that variable, and add paging into this page. (or just to add paging into this page)

Thanks
Igorik
http://www.somvprahe.sk

#2

maartenvg - April 15, 2008 - 08:35

As far as I can see you can remove the GROUP BY statement. It interferes with the pager, which causes it to be hidden, and it doesn't serve a goal.

#3

jrglasgow - April 27, 2009 - 19:41
Status:active» needs review

I found this problem as well. Here is a patch that will solve the issue, at least it solved it for me.

the pager_query() function takes a count query as an option. It says in the documentation that

Unfortunately, the rewrite rule does not always work as intended for queries that already have a "COUNT(*)" or a "GROUP BY" clause, and possibly for other complex queries. In those cases, you can optionally pass a query that will be used to count the records.

I have customized the count query to return the count.

AttachmentSize
advpoll-215675.patch 1.27 KB
 
 

Drupal is a registered trademark of Dries Buytaert.