Fix RideSummaryWindow crash

Fixups for QStringList introduced a new bug
by referencing Time In Zones for HR zones
9 and 10, when in fact they do not go any
higher that 8.

They also were not computed because the
worklist used was updated to include any
HR metrics when the ride is dirty (e.g.
when selecting intervals on ride plot or
updating the metrics within metadata).
This commit is contained in:
Mark Liversedge
2011-09-09 19:10:23 +01:00
parent a8a91022b8
commit 9160501815

View File

@@ -182,9 +182,7 @@ RideSummaryWindow::htmlSummary() const
<< "time_in_zone_H5"
<< "time_in_zone_H6"
<< "time_in_zone_H7"
<< "time_in_zone_H8"
<< "time_in_zone_H9"
<< "time_in_zone_H10";
<< "time_in_zone_H8";
// Use pre-computed and saved metric values if the ride has not
// been edited. Otherwise we need to re-compute every time.
@@ -199,12 +197,14 @@ RideSummaryWindow::htmlSummary() const
worklist += maximumColumn;
worklist += metricColumn;
worklist += timeInZones;
worklist += timeInZonesHR;
// go calculate them then...
QHash<QString, RideMetricPtr> computed = RideMetric::computeMetrics(mainWindow, ride, mainWindow->zones(), mainWindow->hrZones(), worklist);
for(int i = 0; i < worklist.count(); ++i) {
if (worklist[i] != "")
if (worklist[i] != "") {
metrics.setForSymbol(worklist[i], computed.value(worklist[i])->value(true));
}
}
} else {