From adb4d81fdc81f0f149a7be44c1802768cc905588 Mon Sep 17 00:00:00 2001 From: mathieu Date: Thu, 4 Jun 2015 11:05:13 -0400 Subject: [PATCH] Fix #27 --- application/models/measure.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/application/models/measure.php b/application/models/measure.php index 2db63fea..df1bea95 100644 --- a/application/models/measure.php +++ b/application/models/measure.php @@ -127,12 +127,12 @@ function getMeasuresByUser($userId, $userWatches) return $data; } - private function computeAccuracy(&$watchMeasure){ - $userDelta = $watchMeasure->measureUserTime + $watchMeasure->accuracyUserTime; - $refDelta = $watchMeasure->measureReferenceTime + $watchMeasure->accuracyReferenceTime; + private function computeAccuracy($watchMeasure){ + $userDelta = $watchMeasure->accuracyUserTime - $watchMeasure->measureUserTime + ; + $refDelta = $watchMeasure->accuracyReferenceTime - $watchMeasure->measureReferenceTime $accuracy = ($userDelta*86400/$refDelta)-86400; - $accuracy = floor($accuracy*10.0)/10.0; - $watchMeasure->accuracy = $accuracy; + $accuracy = sprintf("%.2f", $accuracy); + return $accuracy; } function addBaseMesure($watchId, $referenceTime, $userTime)