diff --git a/apps/recorder/interface.html b/apps/recorder/interface.html index aa8f5a1845..729b87188a 100644 --- a/apps/recorder/interface.html +++ b/apps/recorder/interface.html @@ -411,10 +411,19 @@ // check track validity after filtering if (!track?.[0]?.Time) return showToast("Error in trackfile (no time or empty).", "error"); let lastTime = 0; + //const trackType = ... -> `${trackType}` const gpx = ` - ${title}${track.map(pt => { + + + Bangle.js + + + + + ${title} + ${track.map(pt => { // Calculate cadence (steps per minute) from step count // Formula: (steps in interval * 60 seconds * 1000ms) / time elapsed in ms // Simplified to: steps * 30000 / time_ms (since 60 * 1000 / 2 = 30000) @@ -710,7 +719,7 @@ if (lIdx >= 0) { var tries = 100; var l = data; - while (l && l.split(",")[lIdx]=="" && tries--) + while (l && l.split(",")[lIdx]==="" && tries--) l = f.readLine(); if (l) data = l; } @@ -719,6 +728,7 @@ if (!trackInfo || !("headers" in trackInfo)) { showToast("Error loading track list.", "error"); resolve(); + return; } trackInfo.headers = trackInfo.headers.split(","); trackList.push({ @@ -842,23 +852,21 @@

Settings

attachTrackButtonListeners(trackContainer); downloadTrack(track.filename).then(fullTrack => { - if (trackData.Latitude) { - const coordinates = fullTrack - .filter(hasValidGPS) - .map(pt => [parseFloat(pt.Latitude), parseFloat(pt.Longitude)]); - - if (coordinates.length > 0) { - createLeafletMap(`map-${track.number}`, coordinates, fullTrack); - - let distance = 0; - for (let i = 1; i < coordinates.length; i++) distance += L.latLng(coordinates[i-1]).distanceTo(L.latLng(coordinates[i])); - const duration = fullTrack[fullTrack.length-1].Time - fullTrack[0].Time; - const hours = Math.floor(duration / 3600000), minutes = Math.floor((duration % 3600000) / 60000); - const statsEl = document.getElementById(`stats-${track.number}`); - if (statsEl) { - const d = convertDistance(distance/1000); - statsEl.innerHTML = `Distance: ${d.value.toFixed(2)} ${d.unit} | Duration: ${hours}h ${minutes}m | Points: ${coordinates.length}`; - } + const coordinates = fullTrack + .filter(hasValidGPS) + .map(pt => [parseFloat(pt.Latitude), parseFloat(pt.Longitude)]); + + if (coordinates.length > 0) { + createLeafletMap(`map-${track.number}`, coordinates, fullTrack); + + let distance = 0; + for (let i = 1; i < coordinates.length; i++) distance += L.latLng(coordinates[i-1]).distanceTo(L.latLng(coordinates[i])); + const duration = fullTrack[fullTrack.length-1].Time - fullTrack[0].Time; + const hours = Math.floor(duration / 3600000), minutes = Math.floor((duration % 3600000) / 60000); + const statsEl = document.getElementById(`stats-${track.number}`); + if (statsEl) { + const d = convertDistance(distance/1000); + statsEl.innerHTML = `Distance: ${d.value.toFixed(2)} ${d.unit} | Duration: ${hours}h ${minutes}m | Points: ${coordinates.length}`; } }