Return cached value

This commit is contained in:
Damien
2012-12-02 00:57:12 +01:00
parent 7c9c7d68b8
commit 7edb4fca0b

View File

@@ -667,8 +667,10 @@ RideFile::getWeight()
QList<SummaryMetrics> measures = mainwindow->metricDB->getAllMeasuresFor(QDateTime::fromString("Jan 1 00:00:00 1900"), startTime());
int i = measures.count()-1;
if (i) {
while (i>=0 && weight_ == 0) {
weight_ = measures[i].getText("Weight", "0.0").toDouble();
while (i>=0) {
if ((weight_ = measures[i].getText("Weight", "0.0").toDouble()) > 0) {
return weight_;
}
i--;
}
}