summaryrefslogtreecommitdiff
path: root/ride/ride.go
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2024-08-07 08:49:20 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2024-08-07 08:49:20 +0200
commit76f13c2c07ccb187d7b8376322cd973fd2d54be4 (patch)
tree77ee3f924e0bc3fd61bda8de332303b4653b74c3 /ride/ride.go
parent7da299025e349f243db540ef0427e511c49c920e (diff)
fix: Remove too short outliers
Diffstat (limited to 'ride/ride.go')
-rw-r--r--ride/ride.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/ride/ride.go b/ride/ride.go
index 2f0b78b..a745b0c 100644
--- a/ride/ride.go
+++ b/ride/ride.go
@@ -59,3 +59,17 @@ func (r *Ride) ScoreFromKm(start, end float64) float64 {
}
return Score(r.points, i, j)
}
+
+func (r *Ride) ClimbFromDist(startDist, endDist float64) Climb {
+ start, end := 0, 0
+ for i, p := range r.points {
+ if start == 0 && p.distance >= startDist {
+ start = i
+ }
+ if end == 0 && p.distance >= endDist {
+ end = i
+ break
+ }
+ }
+ return Climb{start, end}
+}