Fixed bug in prediction report item 4740

This commit is contained in:
manuel 2019-11-08 12:06:06 +01:00
parent c8b39740a9
commit ea83ee1292
2 changed files with 7 additions and 5 deletions

View File

@ -455,7 +455,7 @@ foreach ($items as $item) {
if ($item['type'] == 'custom_graph') {
$custom_graph_name = db_get_row_sql('SELECT name FROM tgraph WHERE id_graph = '.$item['id_gs']);
$row[1] = get_report_name($item['type']).' ('.$custom_graph_name['name'].')';
$row[1] = get_report_name($item['type']).' ('.io_safe_output($custom_graph_name['name']).')';
}

View File

@ -195,7 +195,7 @@ function forecast_projection_graph(
$now = time();
// Check that exec time is not greater than half max exec server time
if ($max_exec_time !== false) {
if ($max_exec_time != false) {
if (($begin_time + ($max_exec_time / 2)) < $now) {
return false;
}
@ -214,15 +214,17 @@ function forecast_projection_graph(
// Using this function for prediction_date
if ($prediction_period == false) {
// These statements stop the prediction when interval is greater than 2 years
if (($current_ts - $last_timestamp) >= 94608000) {
if (($current_ts - $last_timestamp) >= 94608000
|| $max_value == $min_value
) {
return false;
}
// Found it
if (($max_value >= $output_data[$idx][0])
if (($max_value >= $output_data[$idx][1])
&& ($min_value <= $output_data[$idx][0])
) {
return $current_ts;
return ($current_ts + ($sum_diff_dates * $agent_interval));
}
} else if ($current_ts > $limit_timestamp) {
$in_range = false;