From 67647080eaa1961d735e22848a859c6686d5d276 Mon Sep 17 00:00:00 2001 From: Zacharie Date: Tue, 9 Jun 2020 16:57:01 +0200 Subject: [PATCH] Issue #1189 : Bug fix : graph now display last values even if they are null values --- admin/stats.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/admin/stats.php b/admin/stats.php index 0db7e2f2a..93a857ba4 100644 --- a/admin/stats.php +++ b/admin/stats.php @@ -216,7 +216,7 @@ check_status(ACCESS_ADMINISTRATOR); // | Refresh summary from details | // +-----------------------------------------------------------------------+ -history_summarize(); +//history_summarize(); // +-----------------------------------------------------------------------+ // | Display statistics header | @@ -246,7 +246,8 @@ function set_missing_values($unit, $data, $keep_size=true, $firstDate = null, $l $result = array(); if ($firstDate == null) { - $date = get_date_object($data[count($data) - 1]); + //firstDate is actually the last date when keep_size is true because we want the most recent values first + $date = get_date_object($data[0]); } else { $date = $firstDate; } @@ -279,7 +280,7 @@ function set_missing_values($unit, $data, $keep_size=true, $firstDate = null, $l for ($i=0; $i < $limit; $i++) { $result[$date->format($date_format)] = 0; - $date->add(new DateInterval($date_add)); + $date->sub(new DateInterval($date_add)); } } else { if ($lastDate == null)