Ignore:
Timestamp:
04/18/09 04:57:22 (15 years ago)
Author:
nanardon
Message:
  • make difference between settings and their raw value
  • simplify template
  • allow to have a different number of elected people than choice in ballot
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Vote/DB/Poll/Results.pm

    r215 r217  
    135135    my @results; 
    136136    my $abs_maj = $self->absolute_majority; 
    137     my $wanted_count = $self->info('choice_count'); 
     137    my $wanted_count = $self->info('elected_count'); 
    138138    my $voice_count = $self->voices_ballot_count; 
    139139    while (my $res = $sth->fetchrow_hashref) { 
     
    147147                if($res->{count} == $results[-1]->{count}); 
    148148        } 
     149        if (scalar(@results)) { 
     150            $res->{order} = ($res->{count} == $results[-1]->{count} 
     151                ? $results[-1]->{order} 
     152                : scalar(@results) + 1); 
     153        } else { $res->{order} = 1 } 
    149154        $res->{voices_percent} = $res->{count} / $voice_count * 100 
    150155            if($voice_count); # avoid divide by 0 
Note: See TracChangeset for help on using the changeset viewer.