values are now being rounded

This commit is contained in:
Dorian Zedler 2019-07-13 20:03:31 +02:00
parent 8464808bc8
commit 01bb8fc51b

View file

@ -124,7 +124,7 @@ if (isset($_GET['locId'])) {
$takenValuesForNextSum += 1;
}
if ($takenValuesForNextSum === $countOfValuesForAvarage || $i === count($rawMeasvalsOfThisSensor) - 1) {
array_push($finalMeasvalsOfThisSensor, array("measvalue" => $tmpMeasvalueSum / $takenValuesForNextSum, "timestamp" => $tmpTimestampSum / $takenValuesForNextSum, "sensorid" => $sensor["id"]));
array_push($finalMeasvalsOfThisSensor, array("measvalue" => round($tmpMeasvalueSum / $takenValuesForNextSum, 2), "timestamp" => round($tmpTimestampSum / $takenValuesForNextSum, 0), "sensorid" => $sensor["id"]));
$takenValuesForNextSum = 0;
$tmpMeasvalueSum = 0;