Skip to content
This repository has been archived by the owner on Nov 24, 2022. It is now read-only.

Commit

Permalink
Fix broken latitude/longitude values for TCX
Browse files Browse the repository at this point in the history
  • Loading branch information
Metalnem committed Jan 29, 2017
1 parent d02dc39 commit 2f3ea6a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions static/tcx/gps.tcx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<DistanceMeters>20</DistanceMeters>
<AltitudeMeters>2814.324</AltitudeMeters>
<Position>
<LatitudeDegrees>28.915173</LatitudeDegrees>
<LongitudeDegrees>31.87212</LongitudeDegrees>
<LatitudeDegrees>28.91528</LatitudeDegrees>
<LongitudeDegrees>31.87315</LongitudeDegrees>
</Position>
</Trackpoint>
<Trackpoint>
Expand All @@ -28,7 +28,7 @@
<DistanceMeters>40</DistanceMeters>
<AltitudeMeters>2816.279</AltitudeMeters>
<Position>
<LatitudeDegrees>28.915173</LatitudeDegrees>
<LatitudeDegrees>28.91517</LatitudeDegrees>
<LongitudeDegrees>31.87212</LongitudeDegrees>
</Position>
</Trackpoint>
Expand Down
5 changes: 3 additions & 2 deletions tcx/tcx.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ func (exp *Exporter) Export(a api.Activity) error {
var points []trackPoint

for _, point := range a.Data {
point := point

tp := trackPoint{
Time: point.Time.Format(time.RFC3339),
Distance: point.Distance,
Expand All @@ -88,8 +90,7 @@ func (exp *Exporter) Export(a api.Activity) error {
}

if point.HeartRate > 0 {
heartRate := point.HeartRate
tp.HeartRate = &heartRate
tp.HeartRate = &point.HeartRate
}

points = append(points, tp)
Expand Down
4 changes: 2 additions & 2 deletions tcx/tcx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ func TestGPS(t *testing.T) {
Distance: 50,
Data: []api.DataPoint{
{Time: mustParse("2012-10-15T09:32:00Z")},
{Time: mustParse("2012-10-15T09:35:00Z"), Longitude: 31.87315, Latitude: 28.915283, Elevation: 2814.324, Distance: 20},
{Time: mustParse("2012-10-15T09:35:00Z"), Longitude: 31.87315, Latitude: 28.91528, Elevation: 2814.324, Distance: 20},
{Time: mustParse("2012-10-15T09:37:00Z")},
{Time: mustParse("2012-10-15T09:40:00Z"), Longitude: 31.87212, Latitude: 28.915172, Elevation: 2816.279, Distance: 40},
{Time: mustParse("2012-10-15T09:40:00Z"), Longitude: 31.87212, Latitude: 28.91517, Elevation: 2816.279, Distance: 40},
},
}

Expand Down

0 comments on commit 2f3ea6a

Please sign in to comment.