From 765ea1fffcc1bd1af2e6e9645d6f138dfd4ae0eb Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Fri, 21 Aug 2026 22:09:21 +0200 Subject: Require a 3.5% minimum slope on detected climbs, re-segmenting gentler stretches A detected climb must now average at least 3.5% slope with re-segmentation: gentle drags are split into their qualifying steeper parts instead of being reported wholesale or dropped. Qualifying climbs keep their previous boundaries exactly; only regions whose classic best climb averages below the threshold get re-segmented (full-scan for the best qualifying sub-segment, found=false when none exists). QA: A/B across data/rides (362 rides) went from 137 to 133 climbs, 23 rides changed; the 7 fully-dropped rides were audited to contain zero qualifying sub-segments. Example-ride tests updated for the new behavior; the resolved "minimum slope" TODO was removed. --- ride/difficulty_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ride/difficulty_test.go') diff --git a/ride/difficulty_test.go b/ride/difficulty_test.go index 05b60f9..2e7cf56 100644 --- a/ride/difficulty_test.go +++ b/ride/difficulty_test.go @@ -44,7 +44,7 @@ func TestCotacolExampleRide(t *testing.T) { func TestCotacolClimbNotAtStart(t *testing.T) { r := RideBuilder{precision: 100}.WithSection("1km at 0%").WithSection("2km at 7%").Build() - climbs := r.DetectClimbs(nil) + climbs := r.DetectClimbs(nil, ride.ClimbSlopeMinimum) assert.Len(t, climbs, 1) assert.InDelta(t, 98.0, climbs[0].DifficultyScore(), 1e-9) } @@ -78,7 +78,7 @@ func TestCategoryOfBoundaries(t *testing.T) { func TestCotacolHautacamClimbfinderReference(t *testing.T) { r, err := ride.ParseFile(parser, "../examples/2022-07-21.Pogacar.gpx") assert.NoError(t, err) - climbs := r.DetectClimbs(nil) + climbs := r.DetectClimbs(nil, ride.ClimbSlopeMinimum) assert.Len(t, climbs, 6) hautacam := climbs[5] assert.InDelta(t, 128.6, hautacam.StartDistanceM()/1000, 0.1) -- cgit v1.3