Changeset 21 for trunk/lib/Vote/Model/Vote.pm
- Timestamp:
- 03/08/09 19:54:52 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Vote/Model/Vote.pm
r20 r21 307 307 q{ 308 308 select count(*) from ballot where poll = ? 309 and id in (select id from ballot_item) 309 and id in (select id from ballot_item) and invalid = 'false' 310 310 } 311 311 ); … … 387 387 } 388 388 389 sub list_vote_ballot { 390 my ($self, $voteid) = @_; 391 392 my $sth = $self->db->prepare_cached( 393 q{ 394 select id from ballot where poll = ? 395 order by id 396 } 397 ); 398 $sth->execute($voteid); 399 my @ids; 400 while (my $res = $sth->fetchrow_hashref) { 401 push(@ids, $res->{id}); 402 } 403 @ids 404 } 405 406 sub list_vote_ballot_needvalid { 407 my ($self, $voteid) = @_; 408 409 my $sth = $self->db->prepare_cached( 410 q{ 411 select id from ballot where poll = ? 412 and invalid is null order by id 413 } 414 ); 415 $sth->execute($voteid); 416 my @ids; 417 while (my $res = $sth->fetchrow_hashref) { 418 push(@ids, $res->{id}); 419 } 420 @ids 421 } 422 423 sub ballot_info { 424 my ($self, $ballotid) = @_; 425 426 my $sth = $self->db->prepare_cached( 427 q{ select * from ballot where id = ? } 428 ); 429 430 $sth->execute($ballotid); 431 my $res = $sth->fetchrow_hashref; 432 $sth->finish; 433 $res 434 } 435 436 sub ballot_items { 437 my ($self, $ballotid) = @_; 438 439 my $sth = $self->db->prepare_cached( 440 q{select *, value as v from ballot_item where id = ?} 441 ); 442 $sth->execute($ballotid); 443 my @ids; 444 while (my $res = $sth->fetchrow_hashref) { 445 push(@ids, $res); 446 } 447 @ids 448 } 449 450 389 451 =head1 AUTHOR 390 452
Note: See TracChangeset
for help on using the changeset viewer.