diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-08-25 11:24:51 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-08-25 11:24:51 +0200 |
| commit | ff3cd6248f2b78dc76f1ce8cc2337907188fd401 (patch) | |
| tree | 59cb08531d7a7087a0a71c2306ce73330527c8d4 /rideanalysis | |
| parent | 9c2337b50a52ee95011028f6193e0c56aa1fc9d4 (diff) | |
Expose ride data as components and make algorithms consume only the slices they read
Ride now exposes its columns as component getters (Distances, Elevations,
Coords, Timestamps, and the optional Powers, Cadences, HeartRates) with the
coords field unexported. difficultyScore, movingTime, Slope and the climb
detection internals are pure functions over the specific slices they use,
and Climb carries only the component slices it needs instead of a whole
Ride.
Diffstat (limited to 'rideanalysis')
| -rw-r--r-- | rideanalysis/analysis.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/rideanalysis/analysis.go b/rideanalysis/analysis.go index 90be629..55f77b8 100644 --- a/rideanalysis/analysis.go +++ b/rideanalysis/analysis.go @@ -39,7 +39,7 @@ func Analyze(parsed ride.Ride, passes []mountain_pass.MountainPass, officialClim claimedClimbs := make([]AnalyzedClimb, 0) claimedRanges := make([]ride.Range, 0) for _, official := range officialClimbs { - for _, matched := range official_climb.MatchClimbs(parsed.Coords, official, matchPolicy.EndpointRadiusM) { + for _, matched := range official_climb.MatchClimbs(parsed.Coords(), official, matchPolicy.EndpointRadiusM) { claimedRanges = append(claimedRanges, ride.Range{Start: matched.StartIndex, End: matched.EndIndex}) claimedClimbs = append(claimedClimbs, analyzedClimb(parsed, parsed.ClimbFromIndexes(matched.StartIndex, matched.EndIndex), official.Name, official.ID)) } @@ -72,7 +72,7 @@ func analyzedClimb(parsed ride.Ride, segment ride.Climb, name string, officialID Name: name, Category: ride.CategoryOf(cotacol).String(), DistanceM: segment.EndDistanceM() - segment.StartDistanceM(), - SlopePercent: ride.Slope(parsed, segment.StartIndex(), segment.EndIndex()) * 100, + SlopePercent: ride.Slope(parsed.Distances(), parsed.Elevations(), segment.StartIndex(), segment.EndIndex()) * 100, Cotacol: cotacol, OfficialClimbID: officialID, OfficialName: officialClimbNameForID(name, officialID), |
