line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
9
|
|
|
9
|
|
5744
|
use strict; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
269
|
|
2
|
9
|
|
|
9
|
|
42
|
use warnings; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
250
|
|
3
|
9
|
|
|
9
|
|
184
|
use 5.022; |
|
9
|
|
|
|
|
26
|
|
4
|
|
|
|
|
|
|
|
5
|
9
|
|
|
9
|
|
42
|
use feature qw /postderef signatures/; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
1027
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Vote::Count::Approval; |
8
|
|
|
|
|
|
|
$Vote::Count::Approval::VERSION = '0.007'; # TRIAL |
9
|
9
|
|
|
9
|
|
3627
|
use Moose::Role; |
|
9
|
|
|
|
|
41593
|
|
|
9
|
|
|
|
|
34
|
|
10
|
|
|
|
|
|
|
|
11
|
9
|
|
|
9
|
|
47281
|
no warnings 'experimental'; |
|
9
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
2704
|
|
12
|
|
|
|
|
|
|
# use Data::Printer; |
13
|
|
|
|
|
|
|
|
14
|
8
|
|
|
8
|
0
|
28
|
sub Approval ( $self, $active=undef ) { |
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
13
|
|
15
|
8
|
|
|
|
|
209
|
my %BallotSet = $self->BallotSet()->%*; |
16
|
8
|
|
|
|
|
88
|
my %ballots = ( $BallotSet{'ballots'}->%* ); |
17
|
|
|
|
|
|
|
# p %ballots; |
18
|
8
|
100
|
|
|
|
40
|
$active = $BallotSet{'choices'} unless defined $active ; |
19
|
|
|
|
|
|
|
# p $active; |
20
|
8
|
|
|
|
|
32
|
my %approval = ( map { $_ => 0 } keys( $active->%* )); |
|
67
|
|
|
|
|
109
|
|
21
|
8
|
|
|
|
|
34
|
for my $b ( keys %ballots ) { |
22
|
|
|
|
|
|
|
# warn "checkijng $b"; |
23
|
|
|
|
|
|
|
# p $ballots{$b}; |
24
|
|
|
|
|
|
|
# return {}; |
25
|
63
|
|
|
|
|
113
|
my @votes = $ballots{$b}->{'votes'}->@* ; |
26
|
63
|
|
|
|
|
81
|
for my $v ( @votes ) { |
27
|
149
|
100
|
|
|
|
223
|
if ( defined $approval{$v} ) { |
28
|
137
|
|
|
|
|
196
|
$approval{$v} += $ballots{$b}{'count'}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
8
|
|
|
|
|
52
|
return Vote::Count::RankCount->Rank( \%approval ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |