aboutsummaryrefslogtreecommitdiff
path: root/web/views.go
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2026-09-25 08:46:58 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2026-09-25 08:46:58 +0200
commit077aa1700fbcaf3f499c2178e0e58e89ae9dcaf8 (patch)
tree020d0d8b34ab7b47cf551b50034c1e086a247af3 /web/views.go
parent90614736f2a0c556f31eca5361b3c032f5f309f6 (diff)
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.
Diffstat (limited to 'web/views.go')
-rw-r--r--web/views.go12
1 files changed, 12 insertions, 0 deletions
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"