Changeset 177 for branches


Ignore:
Timestamp:
04/10/09 20:01:23 (15 years ago)
Author:
nanardon
Message:
  • backport fix for #28
Location:
branches/1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1

  • branches/1/lib/Vote/Model/Vote.pm

    r155 r177  
    593593    my $sth = $self->db->prepare( 
    594594        q{ 
    595         select count(ballot.id), value from ballot left join ballot_item 
    596         on ballot.id = ballot_item.id where ballot.poll = ? and invalid = 'false' 
     595        select count(ballot.id), value from  
     596        (select ballot.id, coalesce(corrected, value) as "value" from ballot left join ballot_item 
     597        on ballot.id = ballot_item.id where ballot.poll = ? and (invalid = 'false'or invalid is null) 
     598        group by ballot.id, coalesce(corrected, value)) as ballot 
    597599        group by value 
    598         order by count 
     600        order by count desc, value 
    599601        } 
    600602    ); 
     
    612614    my $sth = $self->db->prepare( 
    613615        q{ 
    614         select count(ballot.id), coalesce(corrected, value) as value 
    615         from ballot join ballot_item 
    616         on ballot.id = ballot_item.id where ballot.poll = ? and 
    617         (invalid = 'false' or invalid is null) 
    618         group by coalesce(corrected, value) 
    619         order by count desc 
     616        select count(ballot.id), value from  
     617        (select ballot.id, coalesce(corrected, value) as "value" from ballot join ballot_item 
     618        on ballot.id = ballot_item.id where ballot.poll = ? and (invalid = 'false'or invalid is null) 
     619        group by ballot.id, coalesce(corrected, value)) as ballot 
     620        group by value 
     621        order by count desc, value 
    620622        } 
    621623    ); 
Note: See TracChangeset for help on using the changeset viewer.