Changeset 12 for trunk/lib


Ignore:
Timestamp:
03/06/09 14:10:52 (15 years ago)
Author:
nanardon
Message:
  • add count functions
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Vote/Model/Vote.pm

    r8 r12  
    207207} 
    208208 
     209sub signing_count { 
     210    my ($self, $voteid) = @_; 
     211 
     212    my $sth = $self->db->prepare_cached( 
     213        q{ 
     214        select count(*) from signing join voting 
     215        on voting.key = signing.key where poll = ? 
     216        } 
     217    ); 
     218 
     219    $sth->execute($voteid); 
     220    my $res = $sth->fetchrow_hashref; 
     221    $sth->finish; 
     222    $res->{count} 
     223} 
     224 
     225sub ballot_count { 
     226    my ($self, $voteid) = @_; 
     227 
     228    my $sth = $self->db->prepare_cached( 
     229        q{ 
     230        select count(*) from ballot where poll = ? 
     231        } 
     232    ); 
     233 
     234    $sth->execute($voteid); 
     235    my $res = $sth->fetchrow_hashref; 
     236    $sth->finish; 
     237    $res->{count} 
     238} 
     239 
    209240# Requete de decompte des voix: 
    210241 
Note: See TracChangeset for help on using the changeset viewer.