some typo
This commit is contained in:
parent
79bc1dad46
commit
499e2e547e
|
@ -191,27 +191,26 @@ sub compute {
|
|||
my ($self, %options) = @_;
|
||||
|
||||
my $result;
|
||||
|
||||
if ($options{aggregation} eq 'average') {
|
||||
my $points = 0;
|
||||
foreach my $value (@{$options{values}}) {
|
||||
$result = 0 if (!defined($result));
|
||||
$result += $$value[$options{column}];
|
||||
$result += $value->[$options{column}];
|
||||
$points++;
|
||||
}
|
||||
$result /= $points;
|
||||
} elsif ($options{aggregation} eq 'minimum') {
|
||||
foreach my $value (@{$options{values}}) {
|
||||
$result = $$value[$options{column}] if (!defined($result) || $$value[$options{column}] < $result);
|
||||
$result = $value->[$options{column}] if (!defined($result) || $value->[$options{column}] < $result);
|
||||
}
|
||||
} elsif ($options{aggregation} eq 'maximum') {
|
||||
foreach my $value (@{$options{values}}) {
|
||||
$result = $$value[$options{column}] if (!defined($result) || $$value[$options{column}] > $result);
|
||||
$result = $value->[$options{column}] if (!defined($result) || $value->[$options{column}] > $result);
|
||||
}
|
||||
} elsif ($options{aggregation} eq 'sum') {
|
||||
foreach my $value (@{$options{values}}) {
|
||||
$result = 0 if (!defined($result));
|
||||
$result += $$value[$options{column}];
|
||||
$result += $value->[$options{column}];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ sub manage_selection {
|
|||
|
||||
foreach my $result (@{$queries_results}) {
|
||||
next if (!defined($result->{tags}->{$self->{option_results}->{instance}}));
|
||||
my ($column_index) = grep { $result->{columns}[$_] eq $self->{custom_keys}[$query_index] } (0 .. @{$result->{columns}}-1);
|
||||
my ($column_index) = grep { $result->{columns}[$_] eq $self->{custom_keys}[$query_index] } (0 .. @{$result->{columns}} - 1);
|
||||
my $value;
|
||||
$value = $options{custom}->compute(aggregation => $self->{option_results}->{aggregation}, values => $result->{values}, column => $column_index) if (defined($result->{values}));
|
||||
$self->{queries_results}->{$result->{tags}->{$self->{option_results}->{instance}}}->{instance} = $result->{tags}->{$self->{option_results}->{instance}};
|
||||
|
|
Loading…
Reference in New Issue