aboutsummaryrefslogtreecommitdiff
path: root/web/rides.go
diff options
context:
space:
mode:
Diffstat (limited to 'web/rides.go')
-rw-r--r--web/rides.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/web/rides.go b/web/rides.go
index 81017d9..71ab3fd 100644
--- a/web/rides.go
+++ b/web/rides.go
@@ -65,7 +65,7 @@ func (s *Server) handleRide(w http.ResponseWriter, r *http.Request) {
}), w)
return
}
- passes, err := mountain_pass.LoadMountainPassesAroundRide(s.db, parsed, rideDetailMountainPassMarginM)
+ passes, err := mountain_pass.LoadMountainPassesAroundRide(s.db, parsed.Coords(), rideDetailMountainPassMarginM)
if err != nil {
slog.Warn("Failed to load nearby mountain passes for ride detail", "ride_id", id, "error", err)
}
@@ -144,14 +144,15 @@ func (s *Server) handleCreateOfficialClimb(w http.ResponseWriter, r *http.Reques
http.Error(w, "the recorded route is unavailable", http.StatusBadRequest)
return
}
- if startIndex >= endIndex || endIndex >= parsed.Len() {
+ bounds := parsed.Coords()
+ if startIndex >= endIndex || endIndex >= len(bounds) {
http.Error(w, "the official climb boundaries must be ordered route points", http.StatusBadRequest)
return
}
created, err := official_climb.Create(s.db, official_climb.OfficialClimb{
Name: r.FormValue("name"),
- StartCoord: parsed.Coord(startIndex),
- EndCoord: parsed.Coord(endIndex),
+ StartCoord: bounds[startIndex],
+ EndCoord: bounds[endIndex],
})
if err != nil {
slog.Warn("Failed to create official climb", "ride_id", id, "error", err)