Update of /cvs/scoop/scoop/lib/Scoop
In directory lithium.sabren.com:/tmp/cvs-serv9319/lib/Scoop

Modified Files:
	Polls.pm Search.pm 
Log Message:
Poll bug fixes:

* When posting a top-level comment to a poll, the poll doesn't appear in the "Replying to" field. To reproduce, open a non-attached poll, 
click "post a comment" and look at the "Replying to" area. It'll just say "0". 

* http://bugz.mostly-harmless.ca/show_bug.cgi?id=83 -- posting a comment will cause a section_perm check in Elements.pm to fire when it shouldn't (poll perms are checked earlier).

* Poll search -- go to search, choose polls, you'll get one result per answer for each poll. The postgres patches removed a "GROUP_BY" in 
the search query that prevented that, without replacing it with something that works on postgres and doesn't cause this bug. I replaced 
the group_by, because it works. If it doesn't work with postgres, then it's up to the postgres code to preserve mysql functionality 
(IMO).

--rusty


Index: Polls.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Polls.pm,v
retrieving revision 1.66
retrieving revision 1.67
diff -C2 -d -r1.66 -r1.67
*** Polls.pm	5 Oct 2003 08:56:31 -0000	1.66
--- Polls.pm	26 Jan 2005 19:24:23 -0000	1.67
***************
*** 72,76 ****
  	my $polllist = "";
  	my ($rv, $sth) = $S->db_select({
! 		DEBUG	=> 0,
  		WHAT	=> 'qid, question',
  		FROM	=> 'pollquestions',
--- 72,76 ----
  	my $polllist = "";
  	my ($rv, $sth) = $S->db_select({
! 		DEBUG	=> $DEBUG,
  		WHAT	=> 'qid, question',
  		FROM	=> 'pollquestions',
***************
*** 217,221 ****
  	my ($question, $totalvotes, $actual_totalvotes);
  	my ($rv, $sth) = $S->db_select({
! 		DEBUG => 0,
  		FROM  => 'pollquestions',
  		WHAT  => 'question, voters',
--- 217,221 ----
  	my ($question, $totalvotes, $actual_totalvotes);
  	my ($rv, $sth) = $S->db_select({
! 		DEBUG => $DEBUG,
  		FROM  => 'pollquestions',
  		WHAT  => 'question, voters',
***************
*** 234,238 ****
  
  	($rv, $sth) = $S->db_select({
! 		DEBUG => 0,
  		FROM  => 'pollanswers',
  		WHAT  => 'aid, answer, votes',
--- 234,238 ----
  
  	($rv, $sth) = $S->db_select({
! 		DEBUG => $DEBUG,
  		FROM  => 'pollanswers',
  		WHAT  => 'aid, answer, votes',

Index: Search.pm
===================================================================
RCS file: /cvs/scoop/scoop/lib/Scoop/Search.pm,v
retrieving revision 1.71
retrieving revision 1.72
diff -C2 -d -r1.71 -r1.72
*** Search.pm	25 Jan 2005 17:15:24 -0000	1.71
--- Search.pm	26 Jan 2005 19:24:23 -0000	1.72
***************
*** 754,757 ****
--- 754,758 ----
  		$query->{FROM} = 'pollquestions,pollanswers';
  		$query->{WHERE} = qq|pollquestions.qid = pollanswers.qid AND ( pollquestions.question LIKE '%$args->{string}%' OR pollanswers.answer LIKE '%$args->{string}%' ) |;
+                 $query->{GROUP_BY} = qq|pollquestions.qid|;
  		$query->{ORDER_BY} = 'pollquestions.post_date desc';