Fix intervals in Compare Pane are 1 sample short

The fake rides created for intervals in Compare Pane don't include
the last sample, so they are 1 sample short and 1 sec intervals
don't appear. WPrime calculations are avoided when the ride has
only 1 sample to avoid crashes, besides it doesn't make any sense.
Fixes #4552
This commit is contained in:
Alejandro Martinez
2024-10-11 11:13:47 -03:00
parent b62a2d3190
commit 51b0c9099a
2 changed files with 4 additions and 4 deletions

View File

@@ -699,7 +699,7 @@ ComparePane::dropEvent(QDropEvent *event)
foreach(RideFilePoint *p, ride->dataPoints()) {
if (p->secs >= stop) break;
if (p->secs > stop) break;
if (p->secs >= start) {
@@ -746,7 +746,7 @@ ComparePane::dropEvent(QDropEvent *event)
foreach(XDataPoint *p, xi.value()->datapoints) {
if (p->secs >= stop) break;
if (p->secs > stop) break;
if (p->secs >= start) {

View File

@@ -123,8 +123,8 @@ WPrime::setRide(RideFile *input)
EXP = PCP_ = CP = WPRIME = TAU=0;
// no data or no power data then forget it.
if (!input || input->dataPoints().count() == 0 || input->areDataPresent()->watts == false) {
// less than 2 samples or no power data then forget it.
if (!input || input->dataPoints().count() < 2 || input->areDataPresent()->watts == false) {
return;
}