mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Skip non relevant metrics for RideSummary in Trends view
Adds isMetricRelevantForRides(specification, metric) to RideCache to check if a metric isRelevant for some of the activities passing the specification Also reduces from 3 to 1 the calls to getRideTypeCounts
This commit is contained in:
@@ -902,3 +902,21 @@ RideCache::getRideTypeCounts(Specification specification, int& nActivities,
|
||||
else nRides++;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
RideCache::isMetricRelevantForRides(Specification specification,
|
||||
const RideMetric* metric)
|
||||
{
|
||||
bool isRelevant = false;
|
||||
|
||||
// loop through and aggregate
|
||||
foreach (RideItem *ride, rides_) {
|
||||
|
||||
// skip filtered rides
|
||||
if (!specification.pass(ride)) continue;
|
||||
|
||||
isRelevant = isRelevant || metric->isRelevantForRide(ride);
|
||||
}
|
||||
|
||||
return isRelevant;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user