From 87e29e1eb5a113fbb40d452a193219a40780c302 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Tue, 25 Aug 2026 13:17:20 +0200 Subject: 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. --- ride/ride.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ride/ride.go') 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, -- cgit v1.3