From b960aaeddd787ae469e631802caa3244e44b1bcf Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Fri, 6 Dec 2013 17:07:17 +0000 Subject: [PATCH] Bests offset error .. when plotting 1s best aka Max Power, the code was using the wrong offset (out by one) and returning 0w. --- src/RideFileCache.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/RideFileCache.cpp b/src/RideFileCache.cpp index 7fcc8ad5d..65d6ae75e 100644 --- a/src/RideFileCache.cpp +++ b/src/RideFileCache.cpp @@ -1280,7 +1280,7 @@ RideFileCache::best(Context *context, QString filename, RideFile::SeriesType ser } // jump to correct offset - long offset = offsetForMeanMax(head, series) + (sizeof(float) * (duration-1)); + long offset = offsetForMeanMax(head, series) + (sizeof(float) * (duration)); inFile.skipRawData(offset); float readhere = 0; @@ -1412,7 +1412,7 @@ RideFileCache::getAllBestsFor(Context *context, QList metrics, QDa // get the values and place into the summarymetric map long offset = offsetForMeanMax(head, workitem.series) + (sizeof(head)) + - (sizeof(float) * ((workitem.duration*workitem.duration_units)-1)); + (sizeof(float) * ((workitem.duration*workitem.duration_units))); cacheFile.seek(qint64(offset)); inFile.readRawData((char*)&value, sizeof(float));