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

session fix

parent fe0d36a8
Pipeline #836 passed with stages
in 1 minute and 30 seconds
......@@ -43,7 +43,7 @@ namespace BLL.App.Services
// calculate duration - in seconds
if (session.GpsLocations!.Count > 1)
{
session.Duration = (session.GpsLocations.Last().RecordedAt - session.GpsLocations.First().RecordedAt).TotalSeconds;
session.Duration = (session.GpsLocations.First().RecordedAt - session.GpsLocations.Last().RecordedAt).TotalSeconds;
}
DAL.App.DTO.GpsLocation? prevLocation = null;
......@@ -72,7 +72,7 @@ namespace BLL.App.Services
session.GpsLocations = null;
await UOW.GpsSessions.UpdateAsync(session);
await UOW.SaveChangesAsync();
}
private static double GetDistance(DAL.App.DTO.GpsLocation gpsLocation, DAL.App.DTO.GpsLocation lastLocation)
......
......@@ -26,7 +26,7 @@
<p class="card-text">@Html.DisplayNameFor(model => model.GpsSessionType) - @(item.GpsSessionType!.Name!)</p>
<p class="card-text">@Html.DisplayNameFor(model => model.AppUser) - @(item.AppUser!.FirstLastName)</p>
<p class="card-text">@Html.DisplayNameFor(model => model.RecordedAt) - @Html.DisplayFor(model => item.RecordedAt)</p>
<p class="card-text">@Html.DisplayNameFor(model => model.Duration) - @Html.DisplayFor(model => item.Duration)</p>
<p class="card-text">@Html.DisplayNameFor(model => model.Duration) - @(TimeSpan.FromSeconds(item.Duration).ToString(@"hh\:mm\:ss"))</p>
<p class="card-text">@Html.DisplayNameFor(model => model.Distance) - @((item.Distance / 1000.0).ToString("N3"))</p>
<p class="card-text">@Html.DisplayNameFor(model => model.Climb) - @Html.DisplayFor(model => item.Climb)</p>
<p class="card-text">@Html.DisplayNameFor(model => model.Descent) - @Html.DisplayFor(model => item.Descent)</p>
......
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