From 4276ecf461aba232044b726a7664487895ec47b7 Mon Sep 17 00:00:00 2001 From: juanmanuelr Date: Tue, 31 Jan 2012 12:52:22 +0000 Subject: [PATCH] 2012-01-31 Juan Manuel Ramon * include/functions_reporting: Fixed bug when the module has only one value. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5455 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 5 +++ .../include/functions_reporting.php | 39 ++++++++----------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 45c6f7635d..c8345d3775 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2012-01-31 Juan Manuel Ramon + + * include/functions_reporting: Fixed bug when the module has only + one value. + 2012-01-31 Vanessa Gil * include/functions_reporting: Modified SLA reports when diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 9a7c213db4..0f612cece7 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -718,29 +718,24 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi $first_data = array_shift ($interval_data); $previous_utimestamp = $date - $period; - if ($previous_utimestamp == $first_data['utimestamp']) { - $previous_value = $first_data ['datos']; - $previous_status = 0; - - if ($previous_value < 0) {// 4 for the Unknown value - $previous_status = 4; - } elseif ((($previous_value > ($min_value - $percent)) && ($previous_value < ($min_value + $percent))) || - (($previous_value > ($max_value - $percent)) && ($previous_value < ($max_value + $percent)))) {//2 when value is within the edges - $previous_status = 2; - } elseif (($previous_value >= ($min_value + $percent)) && ($previous_value <= ($max_value - $percent))) { //1 when value is OK - $previous_status = 1; - } elseif (($previous_value <= ($min_value - $percent)) || ($previous_value >= ($max_value + $percent))) { //3 when value is Wrong - $previous_status = 3; - } - - foreach ($downtime_dates as $date_dt) { - if (($date_dt['date_from'] <= $first_data['utimestamp']) AND ($date_dt['date_to'] >= $first_data['utimestamp'])) { - $previous_status = 1; - } - } - } - else { + $previous_value = $first_data ['datos']; + $previous_status = 0; + + if ($previous_value < 0) {// 4 for the Unknown value + $previous_status = 4; + } elseif ((($previous_value > ($min_value - $percent)) && ($previous_value < ($min_value + $percent))) || + (($previous_value > ($max_value - $percent)) && ($previous_value < ($max_value + $percent)))) {//2 when value is within the edges + $previous_status = 2; + } elseif (($previous_value >= ($min_value + $percent)) && ($previous_value <= ($max_value - $percent))) { //1 when value is OK $previous_status = 1; + } elseif (($previous_value <= ($min_value - $percent)) || ($previous_value >= ($max_value + $percent))) { //3 when value is Wrong + $previous_status = 3; + } + + foreach ($downtime_dates as $date_dt) { + if (($date_dt['date_from'] <= $first_data['utimestamp']) AND ($date_dt['date_to'] >= $first_data['utimestamp'])) { + $previous_status = 1; + } } $data_colors = array();