- Timestamp:
- 04/18/09 17:20:17 (15 years ago)
- Location:
- trunk/lib/Vote
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Vote/Controller/Vote.pm
r207 r218 41 41 } 42 42 43 sub report: LocalRegex('^(\d+)/ report.(\w+)$') {43 sub report: LocalRegex('^(\d+)/(results|report).(\w+)$') { 44 44 my ($self, $c, $id, @sub) = @_; 45 ($c->stash->{voteid}, $c->stash->{format}) = @{ $c->req->snippets || [] }; 45 my $doc; 46 ($c->stash->{voteid}, $doc, $c->stash->{format}) = @{ $c->req->snippets || [] }; 46 47 my $vote = $c->model('Vote'); 47 48 $c->stash->{template} = 'default.tt'; … … 58 59 59 60 60 $c->stash->{template} = 'poll_report.tt';61 $c->stash->{template} = "poll_$doc.tt"; 61 62 $c->stash->{latex} = 1; 62 63 } -
trunk/lib/Vote/DB/Poll/Results.pm
r217 r218 52 52 sub voices_ballot_count { 53 53 my ($self) = @_; 54 return $self->not_empty_ballot_count + 55 ($self->info('empty_ballot_has_voice') 56 ? $self->empty_ballot_count 57 : 0); 58 } 59 54 return $self->info('empty_ballot_has_voice') 55 ? $self->valid_ballot_count 56 : $self->not_empty_ballot_count; 57 } 58 59 sub valid_ballot_count { 60 my ($self) = @_; 61 62 my $sth = $self->db->prepare_cached( 63 q{ 64 select count(*) from ballot where poll = ? 65 and (invalid = 'f' or invalid is NULL) 66 } 67 ); 68 69 $sth->execute($self->voteid); 70 my $res = $sth->fetchrow_hashref; 71 $sth->finish; 72 $res->{count} 73 } 74 75 sub invalid_ballot_count { 76 my ($self) = @_; 77 78 my $sth = $self->db->prepare_cached( 79 q{ 80 select count(*) from ballot where poll = ? 81 and invalid = 't' 82 } 83 ); 84 85 $sth->execute($self->voteid); 86 my $res = $sth->fetchrow_hashref; 87 $sth->finish; 88 $res->{count} 89 } 60 90 61 91 sub empty_ballot_count { … … 65 95 q{ 66 96 select count(*) from ballot where poll = ? 67 and id not in (select id from ballot_item) and68 (invalid = 'false' or invalid is null)97 and id not in (select id from ballot_item) 98 and (invalid = 'false' or invalid is null) 69 99 } 70 100 ); … … 82 112 q{ 83 113 select count(*) from ballot where poll = ? 84 and id in (select id from ballot_item) and85 (invalid = 'false' or invalid is null)114 and id in (select id from ballot_item) 115 and (invalid = 'false' or invalid is null) 86 116 } 87 117 );
Note: See TracChangeset
for help on using the changeset viewer.