Skip to content

Commit

Permalink
Strava : Correct commit for indoor lap.
Browse files Browse the repository at this point in the history
Keep last lap seconds
  • Loading branch information
grauser committed May 13, 2019
1 parent 73e5d0b commit d27b4a6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Cloud/Strava.cpp
Expand Up @@ -835,16 +835,17 @@ Strava::prepareResponse(QByteArray* data)
if (!each["laps"].isNull()) {
QJsonArray laps = each["laps"].toArray();

int last_lap = 0;
double last_lap = 0.0;
foreach (QJsonValue value, laps) {
QJsonObject lap = value.toObject();

int lap_start = lap["start_index"].toInt();
if (lap_start == 0)
lap_start = last_lap;
int lap_start = lap["start_index"].toInt();

double start = ride->getPoint(lap_start, RideFile::secs).toDouble();
if (last_lap == 0)
last_lap = start;
double end = start + lap["elapsed_time"].toDouble();

last_lap = end;

ride->addInterval(RideFileInterval::USER, start, end, lap["name"].toString());
Expand Down

0 comments on commit d27b4a6

Please sign in to comment.