mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Generalize HrZones for any sport
All sports defined as values for Sport metadata field can have specifics HR Zones and default to Bike zones otherwise. Similar to current HR zones for Run. Part 2 of #3280
This commit is contained in:
@@ -784,9 +784,10 @@ RideCache::getDistinctValues(QString field)
|
||||
|
||||
void
|
||||
RideCache::getRideTypeCounts(Specification specification, int& nActivities,
|
||||
int& nRides, int& nRuns, int& nSwims)
|
||||
int& nRides, int& nRuns, int& nSwims, QString& sport)
|
||||
{
|
||||
nActivities = nRides = nRuns = nSwims = 0;
|
||||
sport = "";
|
||||
|
||||
// loop through and aggregate
|
||||
foreach (RideItem *ride, rides_) {
|
||||
@@ -794,6 +795,10 @@ RideCache::getRideTypeCounts(Specification specification, int& nActivities,
|
||||
// skip filtered rides
|
||||
if (!specification.pass(ride)) continue;
|
||||
|
||||
// sport is not empty only when all activities are from the same sport
|
||||
if (nActivities == 0) sport = ride->sport;
|
||||
else if (sport != ride-> sport) sport = "";
|
||||
|
||||
nActivities++;
|
||||
if (ride->isSwim) nSwims++;
|
||||
else if (ride->isRun) nRuns++;
|
||||
|
||||
Reference in New Issue
Block a user