Commit 01be3376 authored by Administrator's avatar Administrator

bugfix: distance is total, not relative

parent f201d448
......@@ -41,12 +41,16 @@ extension StatisticFunctions on Map<DateTime, double> {
double sumOfWeights = 0;
DateTime lastTimeStamp;
double lastDistance;
forEach((DateTime timeStamp, double distance) {
final int timeEvolved = lastTimeStamp != null
? timeStamp.difference(lastTimeStamp).inSeconds
: 0;
sumOfValues += distance;
final double distanceEvolved = lastDistance != null
? lastDistance - distance
: 0;
sumOfValues += distanceEvolved;
sumOfWeights += timeEvolved;
lastTimeStamp = timeStamp;
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment