aboutsummaryrefslogtreecommitdiff
path: root/ride/ride.go
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2026-08-25 13:17:20 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2026-08-25 13:17:20 +0200
commit87e29e1eb5a113fbb40d452a193219a40780c302 (patch)
tree75e3e62bd49ca8e5ceaa5b40e02291118fa5c970 /ride/ride.go
parente54e2b313a37c2d2af4e3e537ad4e64e8c816e86 (diff)
Describe test rides as plain strings with a ridetest DSL
Add internal/ridetest parsing "2km at 7% | 1km at -7%" sections into a ride.Ride, with Sampling, StartCoord, StartTime and StartElevation options, plus per-section hr/cad/w metrics. Replace the package-private RideBuilder in climb/difficulty tests and export FromColumnsWithMetrics so metric columns can be built outside the ride package.
Diffstat (limited to 'ride/ride.go')
-rw-r--r--ride/ride.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/ride/ride.go b/ride/ride.go
index 1de8b07..7863878 100644
--- a/ride/ride.go
+++ b/ride/ride.go
@@ -161,6 +161,13 @@ func FromColumns(distances []float64, elevations []float64, coords []geodist.Coo
return fromColumns(distances, elevations, coords, timestamps, nil, nil, nil)
}
+// FromColumnsWithMetrics builds a Ride from its columns, including optional
+// heart-rate, cadence and power components of the same length as the other
+// columns.
+func FromColumnsWithMetrics(distances []float64, elevations []float64, coords []geodist.Coord, timestamps []time.Time, heartRates, cadences, powers []float64) Ride {
+ return fromColumns(distances, elevations, coords, timestamps, heartRates, cadences, powers)
+}
+
func fromColumns(distances []float64, elevations []float64, coords []geodist.Coord, timestamps []time.Time, heartRates, cadences, powers []float64) Ride {
ride := Ride{
distances: distances,