Browse Source

fix the 'tude

meyn 0.1.3
Gisle Aune 10 months ago
parent
commit
d15fa26e79
  1. 49
      lib/tcx.mjs

49
lib/tcx.mjs

@ -28,7 +28,7 @@ export function generateTrimlogInput(filename, name = "Walk", type = "walk") {
latitude: parseFloat(tp.Position?.[0]?.LatitudeDegrees[0]), latitude: parseFloat(tp.Position?.[0]?.LatitudeDegrees[0]),
altitude: parseFloat(tp.AltitudeMeters[0]), altitude: parseFloat(tp.AltitudeMeters[0]),
distance: parseFloat(tp.DistanceMeters[0]), distance: parseFloat(tp.DistanceMeters[0]),
heartrate: parseFloat(tp.HeartRateBpm?.[0].Value?.[0]),
pulse: parseFloat(tp.HeartRateBpm?.[0].Value?.[0]),
}; };
if (minAltitude == null || point.altitude < minAltitude) { if (minAltitude == null || point.altitude < minAltitude) {
@ -52,7 +52,10 @@ export function generateTrimlogInput(filename, name = "Walk", type = "walk") {
measurements: Object.keys(map).sort().map(k => map[k]).map(p => ({ measurements: Object.keys(map).sort().map(k => map[k]).map(p => ({
seconds: Math.round((new Date(p.time) - date) / 1000), seconds: Math.round((new Date(p.time) - date) / 1000),
meters: p.distance, meters: p.distance,
pulse: p.heartrate,
pulse: p.pulse,
longitude: p.longitude,
latitude: p.latitude,
altitude: p.altitude,
})) }))
}}], }}],
description: name, description: name,
@ -75,45 +78,3 @@ export function today() {
} }
function pad(n) {return n > 9 ? n.toString() : `0${n}`} function pad(n) {return n > 9 ? n.toString() : `0${n}`}
/*
{
"date": "2023-12-31",
"contents": [
{
"rawActivity": {
"kind": "Walking",
"sets": [],
"measurements": [
{
"seconds": 1234,
"calories": 4321,
"meters": 432553
},
{
"seconds": 2468,
"calories": 42342,
"meters": 3424
},
{
"seconds": 3702,
"calories": 23423,
"meters": 2342
},
{
"seconds": 4936,
"calories": 23423,
"meters": 2342
}
],
"effortScale": 1,
"weight": 0
}
}
],
"description": "asdfasdfasdf",
"tags": []
}
*/
Loading…
Cancel
Save