aboutsummaryrefslogtreecommitdiff
path: root/web/rides.go
diff options
context:
space:
mode:
Diffstat (limited to 'web/rides.go')
-rw-r--r--web/rides.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/web/rides.go b/web/rides.go
index 10fbb75..1eea98e 100644
--- a/web/rides.go
+++ b/web/rides.go
@@ -10,6 +10,7 @@ import (
"github.com/martinlehoux/biking_home/mountain_pass"
"github.com/martinlehoux/biking_home/official_climb"
"github.com/martinlehoux/biking_home/ride"
+ "github.com/martinlehoux/biking_home/rideanalysis"
"github.com/martinlehoux/kagamigo/kcore"
)
@@ -78,7 +79,7 @@ func (s *Server) handleRide(w http.ResponseWriter, r *http.Request) {
}), w)
return
}
- passes, err := mountain_pass.LoadMountainPassesAroundRide(s.db, parsed.Coords, rideDetailMountainPassMarginM)
+ passes, err := mountain_pass.LoadMountainPassesAroundRide(s.db, parsed.Coords, rideanalysis.PassMarginM)
if err != nil {
slog.Warn("Failed to load nearby mountain passes for ride detail", "ride_id", id, "error", err)
}
@@ -167,10 +168,12 @@ func (s *Server) handleCreateOfficialClimb(w http.ResponseWriter, r *http.Reques
http.Error(w, "the official climb boundaries must be ordered route points", http.StatusBadRequest)
return
}
+ sample := parsed.Sample(startIndex, endIndex)
created, err := official_climb.Create(s.db, official_climb.OfficialClimb{
Name: r.FormValue("name"),
StartCoord: bounds[startIndex],
EndCoord: bounds[endIndex],
+ Sample: sample,
})
if err != nil {
slog.Warn("Failed to create official climb", "ride_id", id, "error", err)
@@ -209,8 +212,6 @@ func (s *Server) listRides(rideSort RideSort) ([]ride.StoredRide, error) {
return ride.ListSorted(s.db, column, rideSort.Descending)
}
-const rideDetailMountainPassMarginM = 10_000
-
func buildRideViews(items []ride.StoredRide) []RideView {
views := make([]RideView, 0, len(items))
for _, item := range items {