aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--climb/detection.go4
-rw-r--r--mise.toml2
-rw-r--r--ride/ride.go8
-rw-r--r--rideanalysis/analysis.go4
-rw-r--r--web/categories.go14
-rw-r--r--web/data_quality.go4
6 files changed, 8 insertions, 28 deletions
diff --git a/climb/detection.go b/climb/detection.go
index 1efe1c5..9269c2f 100644
--- a/climb/detection.go
+++ b/climb/detection.go
@@ -127,7 +127,7 @@ func bestClimbBetween(distances, elevations []float64, minSlope float64) (core.I
bestDetectionScore := climbDetectionScore(distances, elevations)
best := core.NewInterval(0, end)
- for i := 0; i < end; i++ {
+ for i := range end {
detectionScore := climbDetectionScore(distances[i:end], elevations[i:end])
if detectionScore > bestDetectionScore {
best.Start = i
@@ -155,7 +155,7 @@ func bestClimbBetween(distances, elevations []float64, minSlope float64) (core.I
// Classic best too gentle: re-segment into the best qualifying sub-segment.
bestDetectionScore = math.Inf(-1)
best = core.NewInterval(-1, -1)
- for i := 0; i < end; i++ {
+ for i := range end {
for j := i + 1; j <= end; j++ {
if Slope(distances[i:j+1], elevations[i:j+1]) < minSlope {
continue
diff --git a/mise.toml b/mise.toml
index 8458570..eda8c5e 100644
--- a/mise.toml
+++ b/mise.toml
@@ -29,7 +29,7 @@ run = [
"go vet ./...",
"go build ./...",
"go test ./...",
- "go tool deadcode ./...",
+ "go tool deadcode -test $(go list ./... | grep -v '/node_modules')",
]
[tasks.build]
diff --git a/ride/ride.go b/ride/ride.go
index 8e8bf95..77a8e14 100644
--- a/ride/ride.go
+++ b/ride/ride.go
@@ -162,11 +162,9 @@ func FromColumnsWithMetrics(distances []float64, elevations []float64, coords []
func fromColumns(distances []float64, elevations []float64, coords []geodist.Coord, timestamps []time.Time, heartRates, cadences, powers []float64) Ride {
ride := Ride{
- Route: climb.Route{
- Distances: distances,
- Elevations: elevations,
- Coords: coords,
- },
+ Distances: distances,
+ Elevations: elevations,
+ Coords: coords,
timestamps: timestamps,
heartRates: heartRates,
cadences: cadences,
diff --git a/rideanalysis/analysis.go b/rideanalysis/analysis.go
index a9cf93d..883d72c 100644
--- a/rideanalysis/analysis.go
+++ b/rideanalysis/analysis.go
@@ -72,11 +72,11 @@ func Analyze(parsed ride.Ride, passes []mountain_pass.MountainPass, officialClim
// routeClimb returns the climb segment of route covered by interval.
func routeClimb(route climb.Route, interval core.Interval) climb.Climb {
- return climb.Climb{Route: climb.Route{
+ return climb.Climb{
Distances: route.Distances[interval.Start : interval.End+1],
Elevations: route.Elevations[interval.Start : interval.End+1],
Coords: route.Coords[interval.Start : interval.End+1],
- }}
+ }
}
func analyzedClimb(segment climb.Climb, interval core.Interval, name string, officialID int64) AnalyzedClimb {
diff --git a/web/categories.go b/web/categories.go
index 4077092..a76fa1c 100644
--- a/web/categories.go
+++ b/web/categories.go
@@ -67,20 +67,6 @@ var rideTypeLabels = map[ride.RideType]string{
ride.RideTypeTransport: "Transport",
}
-func formatBikeType(value ride.BikeType) string {
- if label, ok := bikeTypeLabels[value]; ok {
- return label
- }
- return string(value)
-}
-
-func formatRideType(value ride.RideType) string {
- if label, ok := rideTypeLabels[value]; ok {
- return label
- }
- return string(value)
-}
-
func formatCategoryOrEmpty(value string) string {
if value == "" {
return "—"
diff --git a/web/data_quality.go b/web/data_quality.go
index 74e84af..562ecf8 100644
--- a/web/data_quality.go
+++ b/web/data_quality.go
@@ -86,10 +86,6 @@ func dataQualityNotice(r *http.Request) string {
return ""
}
-func dataQualityURL() string {
- return "/data-quality"
-}
-
type DataQualityPageData struct {
Items []RideView
Total int