aboutsummaryrefslogtreecommitdiff
path: root/web/views.go
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2026-08-23 11:18:06 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2026-08-23 11:18:06 +0200
commitf7264b8f594859c1430bd13e765db03002842d38 (patch)
treeb4cb9e008b8ba8567ead0a6263b69deb8a8b2f8d /web/views.go
parent53615a05708ff852af42905e2b5ced66ba70c43d (diff)
Add normalized difficulty versus moving duration to analytics
Extend analytics with a second scatter plotting Cotacol per 100 km against moving hours, keep speed versus Cotacol as first chart, render both canvases from shared points, open ride detail in a new tab on dot click, and keep all website copy in English.
Diffstat (limited to 'web/views.go')
-rw-r--r--web/views.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/web/views.go b/web/views.go
index 64afb82..6fd5adf 100644
--- a/web/views.go
+++ b/web/views.go
@@ -36,6 +36,7 @@ type AnalyticsPoint struct {
URL string `json:"url"`
SpeedKmh float64 `json:"speedKmh"`
CotacolPer100Km float64 `json:"cotacolPer100Km"`
+ MovingHours float64 `json:"movingHours"`
}
func buildAnalyticsPoints(items []ride.StoredRide) []AnalyticsPoint {
@@ -51,6 +52,7 @@ func buildAnalyticsPoints(items []ride.StoredRide) []AnalyticsPoint {
URL: rideDetailURL(item.ID),
SpeedKmh: item.AverageSpeedMps * 3.6,
CotacolPer100Km: cotacol * 100 / (item.DistanceM / 1000),
+ MovingHours: float64(item.EffectiveMovingTimeS()) / 3600,
})
}
return points