mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
fix neg alt bug in ElevationGain metric
This commit is contained in:
@@ -126,15 +126,13 @@ class ElevationGain : public RideMetric {
|
||||
}
|
||||
void compute(const RideFile *ride, const Zones *, int,
|
||||
const QHash<QString,RideMetric*> &) {
|
||||
bool first = true;
|
||||
foreach (const RideFilePoint *point, ride->dataPoints()) {
|
||||
if (prevalt <= 0) {
|
||||
prevalt = point->alt;
|
||||
} else if (prevalt <= point->alt) {
|
||||
elegain += (point->alt-prevalt);
|
||||
prevalt = point->alt;
|
||||
} else {
|
||||
prevalt = point->alt;
|
||||
}
|
||||
if (first)
|
||||
first = false;
|
||||
else if (point->alt > prevalt)
|
||||
elegain += point->alt - prevalt;
|
||||
prevalt = point->alt;
|
||||
}
|
||||
}
|
||||
bool canAggregate() const { return true; }
|
||||
|
||||
Reference in New Issue
Block a user