aboutsummaryrefslogtreecommitdiff
path: root/web/categories.go
diff options
context:
space:
mode:
Diffstat (limited to 'web/categories.go')
-rw-r--r--web/categories.go21
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 "—"
+ }
+}