mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-17 01:49:55 +00:00
Added bestime(km) to formulas
To have a general way to track best times for non stardard distances in Metrics Trends charts and User Defined Metrics.
This commit is contained in:
@@ -2296,3 +2296,16 @@ RideBest::getForSymbol(QString symbol, bool metric) const
|
||||
return metricValue;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
RideFileCache::bestTime(double km)
|
||||
{
|
||||
// divisor for series and conversion from secs to hours
|
||||
double divisor = pow(10, decimalsFor(RideFile::kph)) * 3600.0;
|
||||
// linear search over kph mean max array
|
||||
int secs = 0;
|
||||
while (secs < kphMeanMax.count() &&
|
||||
double(kphMeanMax[secs] * secs) / divisor < km) secs++;
|
||||
if (secs < kphMeanMax.count()) return secs;
|
||||
return RideFile::NIL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user