Skip to content

Commit

Permalink
laps
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasPlazas authored and liversedge committed Feb 18, 2022
1 parent 67294a6 commit 2530746
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Cloud/Nolio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,23 @@ QByteArray* Nolio::prepareResponse(QByteArray* data){
}
}

// laps
QJsonArray laps = activity["laps"].toArray();
if (laps.size() > 0){
double start = 0.0;
double end = 0.0;
foreach (QJsonValue value, laps) {
QJsonObject lap = value.toObject();
double duration = lap["duration"].toDouble();
if (start > 0.0){
start = end;
}
end = start + duration;
ride->addInterval(RideFileInterval::USER, start, end, lap["name"].toString());
}

}

JsonFileReader reader;
data->clear();
data->append(reader.toByteArray(context, ride, true, true, true, true));
Expand Down

0 comments on commit 2530746

Please sign in to comment.