diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-08-28 22:38:57 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-08-28 22:38:57 +0200 |
| commit | 827b55f610119d553b965ceb4d3631f0481bbb3b (patch) | |
| tree | df00788440edc234c9d15adc9e49100704675130 /web/categories.go | |
| parent | ff57ebcbe4949b7b53e7c42ecc7916b601a67213 (diff) | |
Rename rides.type to external_sport_type, infer bike type from Strava sport type and display categories in UI
Diffstat (limited to 'web/categories.go')
| -rw-r--r-- | web/categories.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/web/categories.go b/web/categories.go index 74d871c..6ef8c10 100644 --- a/web/categories.go +++ b/web/categories.go @@ -74,3 +74,24 @@ func formatCategoryOrEmpty(value string) string { } return value } + +func formatRideCategories(r ride.StoredRide) string { + bikeLabel, hasBike := bikeTypeLabels[r.BikeType] + rideLabel, hasRide := rideTypeLabels[r.RideType] + switch { + case hasBike && hasRide: + return bikeLabel + " · " + rideLabel + case hasBike: + return bikeLabel + case hasRide: + return rideLabel + default: + if r.BikeType != "" { + return string(r.BikeType) + } + if r.RideType != "" { + return string(r.RideType) + } + return "—" + } +} |
