From e3fda3cc0d8ea48e60fd8cb61fc552f6333211aa Mon Sep 17 00:00:00 2001 From: Ale Martinez Date: Wed, 7 Apr 2021 21:11:44 -0300 Subject: [PATCH] Overview - Fix up/down in Metric and RPE tiles Add declaration for variable v inside the loop used to compute avg/min/max to avoid affecting variable v in the outer scope, this is the minimum change to fix the problem and the same pattern is present in other tiles. Without this change up/down is based on the first activity of the same sport in the previous 30 days, instead of the current one. --- src/Charts/OverviewItems.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Charts/OverviewItems.cpp b/src/Charts/OverviewItems.cpp index 568669e8b..c53557389 100644 --- a/src/Charts/OverviewItems.cpp +++ b/src/Charts/OverviewItems.cpp @@ -518,7 +518,7 @@ RPEOverviewItem::setData(RideItem *item) // only activities with matching sport flags if (prior->isRun == item->isRun && prior->isSwim == item->isSwim) { - v = prior->getText("RPE", "0").toDouble(); + double v = prior->getText("RPE", "0").toDouble(); if (std::isinf(v) || std::isnan(v)) v=0; // new no zero value @@ -593,6 +593,8 @@ MetricOverviewItem::setData(RideItem *item) // only activities with matching sport flags if (prior->isRun == item->isRun && prior->isSwim == item->isSwim) { + double v; + if (units == tr("seconds")) v = prior->getForSymbol(symbol, GlobalContext::context()->useMetricUnits); else { QString vs = prior->getStringForSymbol(symbol, GlobalContext::context()->useMetricUnits);