mirror of
https://github.com/pi-hole/web.git
synced 2026-04-28 04:33:58 +01:00
Don't fill the all slots with zeros
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
This commit is contained in:
13
api_db.php
13
api_db.php
@@ -339,19 +339,6 @@ if (isset($_GET['getGraphData']) && $auth) {
|
||||
}
|
||||
}
|
||||
|
||||
// It is unpredictable what the first timestamp returned by the database
|
||||
// will be. This depends on live data. Hence, we re-align the FROM
|
||||
// timestamp to avoid unaligned holes appearing as additional
|
||||
// (incorrect) data points
|
||||
$aligned_from = $from + (($first_db_timestamp - $from) % $interval);
|
||||
|
||||
// Fill gaps in returned data
|
||||
for ($i = $aligned_from; $i < $until; $i += $interval) {
|
||||
if (!array_key_exists($i, $data)) {
|
||||
$data[$i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user