- Timestamp:
- 04/17/09 18:52:21 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Vote/DB/Poll/Results.pm
r214 r215 134 134 $sth->execute($self->voteid, $self->voteid); 135 135 my @results; 136 my $abs_maj = $self->absolute_majority; 137 my $wanted_count = $self->info('choice_count'); 138 my $voice_count = $self->voices_ballot_count; 136 139 while (my $res = $sth->fetchrow_hashref) { 140 if ($res->{count} >= $abs_maj) { 141 $res->{abs_maj} = 1; 142 } 143 if (scalar(@results) < $wanted_count) { 144 $res->{elected} = 1 if ($res->{count}); 145 } elsif (scalar(@results)) { 146 $res->{elected} = $results[-1]->{elected} 147 if($res->{count} == $results[-1]->{count}); 148 } 149 $res->{voices_percent} = $res->{count} / $voice_count * 100 150 if($voice_count); # avoid divide by 0 151 137 152 push(@results, $res); 138 153 }
Note: See TracChangeset
for help on using the changeset viewer.