Commit f62f1d35 authored by Andres Käver's avatar Andres Käver
Browse files

bll

parent 474110c4
Pipeline #841 passed with stages
in 1 minute and 29 seconds
...@@ -41,7 +41,8 @@ namespace BLL.App.Services ...@@ -41,7 +41,8 @@ namespace BLL.App.Services
var lastLocation = await UOW.GpsLocations.LastInSessionAsync(gpsSession.Id); var lastLocation = await UOW.GpsLocations.LastInSessionAsync(gpsSession.Id);
if (lastLocation != null) // skip out of sync locations
if (lastLocation != null && lastLocation.RecordedAt < gpsLocation.RecordedAt)
{ {
// calculate the metrics // calculate the metrics
var distance = getDistance(gpsLocation, lastLocation); var distance = getDistance(gpsLocation, lastLocation);
...@@ -52,10 +53,10 @@ namespace BLL.App.Services ...@@ -52,10 +53,10 @@ namespace BLL.App.Services
gpsSession.Descent += Math.Abs(vertical); gpsSession.Descent += Math.Abs(vertical);
} else if (vertical > 0) } else if (vertical > 0)
{ {
gpsSession.Descent += vertical; gpsSession.Climb += vertical;
} }
gpsSession.Duration = (gpsSession.RecordedAt - lastLocation.RecordedAt).TotalSeconds; gpsSession.Duration = (lastLocation.RecordedAt - gpsSession.RecordedAt).TotalSeconds;
await UOW.GpsSessions.UpdateAsync(gpsSession); await UOW.GpsSessions.UpdateAsync(gpsSession);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment