From e3d0beee5be3dd2854b0f4fc10905a4fcdc08f47 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Sun, 13 Sep 2026 21:55:59 +0200 Subject: Persist official climb attempts with climbs pages Record one attempt row per (ride, climb, occurrence) when a ride detail loads, snapshotting distance, elevation gain, slope, cotacol and attempt timestamps; a climbs-backfill CLI command seeds all existing rides. New /climbs list page aggregates attempts (medians computed in Go, best time as min duration) with sortable columns, and /climbs/{id} shows the median scalar stats, a median normalized elevation profile (50 steps over each attempt's own length), the full-precision recorded route of the median-distance attempt on an OSM map, and every attempt with time at second precision. --- web/templates.templ | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 1 deletion(-) (limited to 'web/templates.templ') diff --git a/web/templates.templ b/web/templates.templ index 14e9aab..d41dd39 100644 --- a/web/templates.templ +++ b/web/templates.templ @@ -15,7 +15,7 @@ templ Layout(title string, content templ.Component) {
@content @@ -485,3 +485,89 @@ templ DataQualityContent(data DataQualityPageData) { } } +templ ClimbsPage(data ClimbsPageData) { + @Layout("Climbs", ClimbsContent(data)) +} + +templ ClimbsContent(data ClimbsPageData) { +

Official climbs

+
+ if len(data.Items) == 0 { +
No official climbs yet. Create one from a ride detail page.
+ } else { + + + for _, header := range data.Headers { + + } + + + for _, item := range data.Items { + + } + +
{ header.Label }
{ item.Climb.Name }{ item.Category }{ formatClimbCount(item.Climb.Attempts) }{ item.Distance }{ item.Slope }{ item.Cotacol }{ item.BestTime }
+ } +
+} + +templ ClimbDetailPage(data ClimbDetailPageData) { + @Layout("Climb", ClimbDetailContent(data)) +} + +templ ClimbDetailContent(data ClimbDetailPageData) { +
+

{ data.Climb.Name }

Official climb ยท { data.Stats.Category }

+ +
+
+
+
Attempts
{ data.Stats.Attempts }
+
Distance
{ data.Stats.Distance }
+
Elevation
{ data.Stats.ElevationG }
+
Avg slope
{ data.Stats.Slope }
+
Cotacol
{ data.Stats.Cotacol }
+
Best time
{ data.Stats.BestTime }
+
+
+
+ +
+ if len(data.Profile.Elevations) > 0 { +
+

Profile

Median profile

+
+

Hover or focus the profile to inspect the climb at a distance.

+
+ <=0% + 0โ€“3% + 3โ€“6% + 6โ€“9% + 9%+ +
+
+ } +
+
+

History

Attempts

+ { formatClimbCount(len(data.Attempts)) } +
+ if len(data.Attempts) == 0 { +
No attempts recorded yet. Open a ride containing this climb to record one.
+ } else { + + + + for _, attempt := range data.Attempts { + + } + +
DateRideTimeDistanceCotacol
{ attempt.Date }{ attempt.RideName }{ attempt.Duration }{ attempt.Distance }{ attempt.Cotacol }
+ } +
+ @templ.JSONScript("climb-profile-data", data.Profile) + @templ.JSONScript("climb-endpoints", data.Endpoints) + + + +} -- cgit v1.3