iwa-panda1

Manage Weather Data by International Weather Agency (Version 1)
Log | Files | Refs

commit 727b80d6eb12a02aae47f6a4969fb05926ea7482
parent 67941b40341186a6c0055b86a80e5d665c16124b
Author: LennartSchroot <[email protected]>
Date:   Fri, 14 Apr 2023 12:59:06 +0200

Update datavalidator.php

Diffstat:
Mdatavalidator.php | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/datavalidator.php b/datavalidator.php @@ -29,7 +29,7 @@ function validate_temperature($station, $temperature, $redis) { //Bij 30 values zal de volgende value eerst gecheckt worden met het bekende gemiddelde en eventueel aangepast worden. //Daarna zal deze toegevoegd worden aan de value en average queue. De laatste waarde zal eruit gehaald worden. else { - $current_avg = $redis->lIndex('average'.$station, 0); + $current_avg = $redis->lIndex('average'.$station, 0) ?: 0.000000000000001; if(abs(($temperature - $current_avg) / $current_avg) > 0.2) { $temperature = $current_avg; $new_avg = (($redis->rpop('average'.$station) * 3) - $redis->rpop('values'.$station) + $temperature) / 3;