Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
com.akaver.sportmap
SportMap-ASPNET
Commits
c055e5c7
Commit
c055e5c7
authored
May 10, 2020
by
Andres Käver
Browse files
first location fix
parent
b0b13225
Pipeline
#823
passed with stages
in 1 minute and 30 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
BLL.App/Services/GpsLocationService.cs
View file @
c055e5c7
...
...
@@ -37,21 +37,24 @@ namespace BLL.App.Services
var
gpsSession
=
await
UOW
.
GpsSessions
.
FirstOrDefaultAsync
(
gpsLocation
.
GpsSessionId
,
gpsLocation
.
AppUserId
);
var
lastLocation
=
await
UOW
.
GpsLocations
.
LastInSessionAsync
(
gpsSession
.
Id
);
// calculate the metrics
var
distance
=
getDistance
(
gpsLocation
,
lastLocation
);
var
vertical
=
getVerticalDistance
(
gpsLocation
,
lastLocation
);
gpsSession
.
Distance
+=
distance
;
if
(
vertical
<
0
)
if
(
lastLocation
!=
null
)
{
gpsSession
.
Descent
+=
Math
.
Abs
(
vertical
);
}
else
if
(
vertical
>
0
)
{
gpsSession
.
Descent
+=
vertical
;
}
// calculate the metrics
var
distance
=
getDistance
(
gpsLocation
,
lastLocation
);
var
vertical
=
getVerticalDistance
(
gpsLocation
,
lastLocation
);
gpsSession
.
Distance
+=
distance
;
if
(
vertical
<
0
)
{
gpsSession
.
Descent
+=
Math
.
Abs
(
vertical
);
}
else
if
(
vertical
>
0
)
{
gpsSession
.
Descent
+=
vertical
;
}
gpsSession
.
Duration
=
(
gpsSession
.
RecordedAt
-
lastLocation
.
RecordedAt
).
TotalSeconds
;
gpsSession
.
Duration
=
(
gpsSession
.
RecordedAt
-
lastLocation
.
RecordedAt
).
TotalSeconds
;
await
UOW
.
GpsSessions
.
UpdateAsync
(
gpsSession
);
await
UOW
.
GpsSessions
.
UpdateAsync
(
gpsSession
);
}
return
base
.
Add
(
gpsLocation
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment