From 077aa1700fbcaf3f499c2178e0e58e89ae9dcaf8 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Fri, 25 Sep 2026 08:46:58 +0200 Subject: Chart power vs time for official climb attempts Snapshot average power per attempt in a nullable average_power_w column (backfilled from stored rides), plot each powered attempt on the climb page as duration vs average watts with ride hover and click-through, and show avg power in the attempts table. --- web/views.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'web/views.go') diff --git a/web/views.go b/web/views.go index 5dfc0e6..af3dbc2 100644 --- a/web/views.go +++ b/web/views.go @@ -448,6 +448,14 @@ func formatElevation(meters float64) string { return fmt.Sprintf("%.0f m", meters) } +// formatPower renders an attempt's average power; a missing power meter shows "-". +func formatPower(watts *float64) string { + if watts == nil { + return "-" + } + return fmt.Sprintf("%.0f W", *watts) +} + func formatCotacol(cotacol float64) string { return fmt.Sprintf("%.1f", cotacol) } @@ -488,6 +496,10 @@ func officialProfileLabel(name string) string { return "Elevation profile for " + name } +func attemptsChartLabel(name string) string { + return "Power vs time of recorded attempts at " + name +} + func rideDetailColumnsClass(unmatchedClimbCount int) string { if unmatchedClimbCount == 0 { return "ride-detail-columns ride-detail-columns-single" -- cgit v1.3