aboutsummaryrefslogtreecommitdiff
path: root/cli/cli.go
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2026-08-27 19:07:33 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2026-08-27 19:07:33 +0200
commit4a61f3eb3103aa512bef1b0d82295403bc4bc977 (patch)
tree73eb78c50518f129d5e6aaa86153a1b4c4637bf5 /cli/cli.go
parentd7b93325d4f70eeab369fa8a3c4cce9f0c4e0081 (diff)
Swap ride read path from GPX to FIT for performance
Always use FIT for detail, official climb creation and backtest; keep GPX fallback for legacy rides pending backfill. FIT is 10-20x smaller and parses without XML.
Diffstat (limited to 'cli/cli.go')
-rw-r--r--cli/cli.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/cli/cli.go b/cli/cli.go
index c71fd9e..672cc34 100644
--- a/cli/cli.go
+++ b/cli/cli.go
@@ -145,12 +145,12 @@ func runBacktest(db *sql.DB) error {
if !isBacktestEligible(item) {
continue
}
- parsed, err := ride.ParseFile(ride.GPXRideParser{}, item.GPXPath)
+ parsed, err := ride.ParseFile(ride.FITRideParser{}, item.FitPath)
if err != nil {
if errors.Is(err, ride.ErrNoTrackPoints) {
continue
}
- slog.Warn("Failed to parse ride GPX", "ride", item.ExternalID, "file", item.GPXPath, "error", err)
+ slog.Warn("Failed to parse ride FIT", "ride", item.ExternalID, "file", item.FitPath, "error", err)
continue
}
reference := time.Duration(item.ExternalMovingTimeS) * time.Second
@@ -164,7 +164,7 @@ func runBacktest(db *sql.DB) error {
})
}
if len(samples) == 0 {
- slog.Info("No rides with GPX to backtest", "rides", len(items))
+ slog.Info("No rides with FIT to backtest", "rides", len(items))
return nil
}
sort.Slice(samples, func(i, j int) bool {
@@ -195,7 +195,7 @@ func runBacktest(db *sql.DB) error {
}
func isBacktestEligible(item ride.StoredRide) bool {
- if item.GPXPath == "" || item.ExternalMovingTimeS <= 0 || item.ElapsedTimeS <= 0 {
+ if item.FitPath == "" || item.ExternalMovingTimeS <= 0 || item.ElapsedTimeS <= 0 {
return false
}
if !item.IsCategorised() {