Fix Hr and Power Zone metrics

Sanity check was reversed so decimal part always computed to max
and becomes undervalued.
Fixes #3531
This commit is contained in:
Ale Martinez
2020-07-05 11:27:40 -03:00
parent c16d4c4667
commit 94c723f4a0
2 changed files with 3 additions and 5 deletions

View File

@@ -82,7 +82,7 @@ class HrZone : public RideMetric {
// use MaxHr as upper bound, this is used
// for the limit of upper zone ALWAYS
const int pmax = zones->getMaxHr(item->hrZoneRange);
high = std::max(high, pmax);
high = std::min(high, pmax);
// how far in?
percent = double(ahr-low) / double(high-low);

View File

@@ -99,12 +99,10 @@ class PeakPercent : public RideMetric {
class PowerZone : public RideMetric {
Q_DECLARE_TR_FUNCTIONS(PowerZone)
double maxp;
double minp;
public:
PowerZone() : maxp(0.0), minp(10000)
PowerZone()
{
setType(RideMetric::Average);
setSymbol("power_zone");
@@ -153,7 +151,7 @@ class PowerZone : public RideMetric {
// use Pmax as upper bound, this is used
// for the limit of upper zone ALWAYS
const int pmax = zones->getPmax(item->zoneRange);
high = std::max(high, pmax);
high = std::min(high, pmax);
// how far in?
percent = double(ap-low) / double(high-low);