From 7b6bd3ae858c5d7877f9ef137a3ff3d6f71ce1fc Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Tue, 1 Sep 2026 15:32:38 +0200 Subject: feat: Analyse and fix elevation issues --- web/frontend/ride-detail-boundaries.ts | 3 ++- web/frontend/ride-detail.ts | 2 +- web/frontend/types.d.ts | 1 + web/views.go | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) (limited to 'web') diff --git a/web/frontend/ride-detail-boundaries.ts b/web/frontend/ride-detail-boundaries.ts index 22a1255..a9bb8e1 100644 --- a/web/frontend/ride-detail-boundaries.ts +++ b/web/frontend/ride-detail-boundaries.ts @@ -118,6 +118,7 @@ export class RideBoundaryController { boundaryLabel(index: number): string { const point = this.points[index]; - return `${formatDistance(point.distanceKm)} · ${formatElevation(point.elevationM)}`; + const idx = point.index ?? index; + return `#${idx} · ${formatDistance(point.distanceKm)} · ${formatElevation(point.elevationM)}`; } } diff --git a/web/frontend/ride-detail.ts b/web/frontend/ride-detail.ts index 045372e..b8d2898 100644 --- a/web/frontend/ride-detail.ts +++ b/web/frontend/ride-detail.ts @@ -93,7 +93,7 @@ export const mountRideDetail = (): void => { } const point = points[index]; mapController.showPoint(index); - hoverOutput.textContent = `${formatDistance(point.distanceKm)} · ${formatElevation(point.elevationM)}`; + hoverOutput.textContent = `#${point.index ?? index} · ${formatDistance(point.distanceKm)} · ${formatElevation(point.elevationM)}`; }, }); diff --git a/web/frontend/types.d.ts b/web/frontend/types.d.ts index 790abe6..87be024 100644 --- a/web/frontend/types.d.ts +++ b/web/frontend/types.d.ts @@ -8,6 +8,7 @@ export interface ProfilePoint { } export interface RideProfilePoint extends ProfilePoint { + index: number; latitude: number; longitude: number; } diff --git a/web/views.go b/web/views.go index ddea27e..952b045 100644 --- a/web/views.go +++ b/web/views.go @@ -113,6 +113,7 @@ func (profile RideProfile) UnmatchedClimbs() []RideProfileClimb { } type RideProfilePoint struct { + Index int `json:"index"` DistanceKm float64 `json:"distanceKm"` ElevationM float64 `json:"elevationM"` Latitude float64 `json:"latitude"` @@ -353,6 +354,7 @@ func buildRideProfile(parsed ride.Ride, passes []mountain_pass.MountainPass, off } for i, coordinate := range coords { profile.Points[i] = RideProfilePoint{ + Index: i, DistanceKm: distances[i] / 1000, ElevationM: elevations[i], Latitude: coordinate.Lat, -- cgit v1.3