Merge pull request #1502 from jotomo/upstream-1501

[For review] Correct off-by-one error calculating average.
This commit is contained in:
Milos Kozak 2018-10-13 18:19:57 +02:00 committed by GitHub
commit 9309729ca1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -146,7 +146,7 @@ public class IobCobCalculatorPlugin extends PluginBase {
return false;
}
}
double averageDiff = totalDiff / (bgReadings.size() - 1) / 1000d;
long averageDiff = totalDiff / bgReadings.size() / 1000;
boolean is5mindata = averageDiff < 1;
if (L.isEnabled(L.AUTOSENS))
log.debug("Interval detection: values: " + bgReadings.size() + " averageDiff: " + averageDiff + "[s] is5minData: " + is5mindata);