6.0.0-beta1
9/23/25

[#1996] Poll block broken for latest poll option
Summary Poll block broken for latest poll option
Queue Scry
Type Bug
State Resolved
Priority 1. Low
Owners Horde Developers (at)
Requester jason (at) alteredminds (dot) com
Created 05/19/2005 (7432 days ago)
Due
Updated 05/30/2005 (7421 days ago)
Assigned 05/21/2005 (7430 days ago)
Resolved 05/30/2005 (7421 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
05/30/2005 07:09:02 PM Chuck Hagenbuch Comment #5
State ⇒ Resolved
Reply to this comment
Fixed in CVS.
05/30/2005 04:39:36 AM Chuck Hagenbuch Comment #4 Reply to this comment
I think the answer here is going to be splitting the SQL in getPolls 
to load polls in one query and options in a second. Still 2 queries 
max ,and then the limitQuery logic could work correctly.
05/21/2005 04:15:17 AM Chuck Hagenbuch Assigned to Horde DevelopersHorde Developers
State ⇒ Assigned
 
05/19/2005 09:43:13 AM jason (at) alteredminds (dot) com Comment #3 Reply to this comment
No problem.



These are the log lines from the execution of the Block after I have 
voted on the poll.



May 19 10:37:07 wintermute HORDE[9728]: [scry] SQL Query by 
Scry_Driver_sql::getPolls(): SELECT * FROM scry_polls LEFT JOIN 
scry_choices ON scry_polls.poll_id = scry_choices.poll_id  WHERE 
poll_enabled = 1 AND (1116495427 >= poll_start OR poll_start IS NULL) 
AND (1116495427 < poll_end OR poll_end IS NULL) LIMIT 1 OFFSET 0 [on 
line 116 of 
"/export/home/jason/html/beta/horde/scry/lib/Driver/sql.php"]

May 19 10:37:07 wintermute HORDE[9728]: [scry] SQL Query by 
Scry_Driver_sql::getPolls(): SELECT * FROM scry_polls LEFT JOIN 
scry_choices ON scry_polls.poll_id = scry_choices.poll_id  WHERE 
scry_polls.poll_id = 4 [on line 116 of 
"/export/home/jason/html/beta/horde/scry/lib/Driver/sql.php"]

May 19 10:37:07 wintermute HORDE[9728]: [scry] SQL Query by 
Scry_Driver_sql::getVotes(): SELECT scry_choices.poll_id, 
choice_value, COUNT(vote_id) AS vote_count                           
FROM scry_choices LEFT JOIN scry_votes                           ON 
scry_choices.choice_id = scry_votes.choice_id  WHERE 
scry_votes.vote_confirmation IS NULL AND scry_choices.poll_id = 4       
                      GROUP BY scry_choices.poll_id, 
scry_choices.choice_value, scry_choices.choice_id                       
      ORDER BY scry_choices.poll_id, vo



The result of the first query is only one line due to the limit 
directive being set to 1. Using the patch this limit is upped to the 
maximum number of possible poll elements. Thinking about it this is 
not the most ideal way of getting all the questions out, but it does 
work.


05/19/2005 09:30:46 AM Jan Schneider Comment #2
State ⇒ Feedback
Reply to this comment
Looking at the code docs, this doesn't seem right. Can you enable 
debug logging and post the SQL statement that you get *without* your 
patch?
05/19/2005 07:44:24 AM jason (at) alteredminds (dot) com Comment #1
State ⇒ Unconfirmed
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ Poll block broken for latest poll option
Queue ⇒ Scry
New Attachment: scry.patch Download
Reply to this comment
When using the "Polls: Show Poll" block and setting it to "Always show 
latest" it will display only the first choice for the latest poll, not 
the complete list of choices for that poll.



The attached patch is required to get the whole poll to display.



I am using the latest version of CVS head for everything as of this 
date. The polls are being stored in  a postgres database.

Saved Queries