Strava : Correct commit for indoor lap.

Keep last lap seconds
This commit is contained in:
grauser
2019-05-12 23:09:41 +02:00
parent 73e5d0bd4d
commit d27b4a639b

View File

@@ -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());