From 499e2e547ea9270026098ad390169a7d9bec7cc2 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Thu, 14 Nov 2019 10:31:44 +0100 Subject: [PATCH] some typo --- database/influxdb/custom/api.pm | 9 ++++----- database/influxdb/mode/query.pm | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/database/influxdb/custom/api.pm b/database/influxdb/custom/api.pm index 6c3c2fa4c..e32daf7ab 100644 --- a/database/influxdb/custom/api.pm +++ b/database/influxdb/custom/api.pm @@ -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}]; } } diff --git a/database/influxdb/mode/query.pm b/database/influxdb/mode/query.pm index 438fc74ef..7974568e2 100644 --- a/database/influxdb/mode/query.pm +++ b/database/influxdb/mode/query.pm @@ -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}};