@@ -842,23 +842,21 @@ <h2>Settings</h2>
842842 attachTrackButtonListeners ( trackContainer ) ;
843843
844844 downloadTrack ( track . filename ) . then ( fullTrack => {
845- if ( trackData . Latitude ) {
846- const coordinates = fullTrack
847- . filter ( hasValidGPS )
848- . map ( pt => [ parseFloat ( pt . Latitude ) , parseFloat ( pt . Longitude ) ] ) ;
849-
850- if ( coordinates . length > 0 ) {
851- createLeafletMap ( `map-${ track . number } ` , coordinates , fullTrack ) ;
852-
853- let distance = 0 ;
854- for ( let i = 1 ; i < coordinates . length ; i ++ ) distance += L . latLng ( coordinates [ i - 1 ] ) . distanceTo ( L . latLng ( coordinates [ i ] ) ) ;
855- const duration = fullTrack [ fullTrack . length - 1 ] . Time - fullTrack [ 0 ] . Time ;
856- const hours = Math . floor ( duration / 3600000 ) , minutes = Math . floor ( ( duration % 3600000 ) / 60000 ) ;
857- const statsEl = document . getElementById ( `stats-${ track . number } ` ) ;
858- if ( statsEl ) {
859- const d = convertDistance ( distance / 1000 ) ;
860- statsEl . innerHTML = `<strong>Distance:</strong> ${ d . value . toFixed ( 2 ) } ${ d . unit } | <strong>Duration:</strong> ${ hours } h ${ minutes } m | <strong>Points:</strong> ${ coordinates . length } ` ;
861- }
845+ const coordinates = fullTrack
846+ . filter ( hasValidGPS )
847+ . map ( pt => [ parseFloat ( pt . Latitude ) , parseFloat ( pt . Longitude ) ] ) ;
848+
849+ if ( coordinates . length > 0 ) {
850+ createLeafletMap ( `map-${ track . number } ` , coordinates , fullTrack ) ;
851+
852+ let distance = 0 ;
853+ for ( let i = 1 ; i < coordinates . length ; i ++ ) distance += L . latLng ( coordinates [ i - 1 ] ) . distanceTo ( L . latLng ( coordinates [ i ] ) ) ;
854+ const duration = fullTrack [ fullTrack . length - 1 ] . Time - fullTrack [ 0 ] . Time ;
855+ const hours = Math . floor ( duration / 3600000 ) , minutes = Math . floor ( ( duration % 3600000 ) / 60000 ) ;
856+ const statsEl = document . getElementById ( `stats-${ track . number } ` ) ;
857+ if ( statsEl ) {
858+ const d = convertDistance ( distance / 1000 ) ;
859+ statsEl . innerHTML = `<strong>Distance:</strong> ${ d . value . toFixed ( 2 ) } ${ d . unit } | <strong>Duration:</strong> ${ hours } h ${ minutes } m | <strong>Points:</strong> ${ coordinates . length } ` ;
862860 }
863861 }
864862
0 commit comments