diff options
Diffstat (limited to 'web/views.go')
| -rw-r--r-- | web/views.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/web/views.go b/web/views.go index 1bf1782..5422421 100644 --- a/web/views.go +++ b/web/views.go @@ -137,6 +137,7 @@ const ( rideSortStarted = "started" rideSortDistance = "distance" rideSortMovingTime = "moving_time" + rideSortSpeed = "speed" rideSortElevation = "elevation" rideSortCotacol = "cotacol" rideSortCotacolKm = "cotacol_100km" @@ -147,6 +148,7 @@ var rideSortColumns = map[string]bool{ rideSortStarted: true, rideSortDistance: true, rideSortMovingTime: true, + rideSortSpeed: true, rideSortElevation: true, rideSortCotacol: true, rideSortCotacolKm: true, @@ -167,6 +169,7 @@ func (s RideSort) databaseColumn() (rides.SortColumn, bool) { rideSortStarted: rides.SortStartDate, rideSortDistance: rides.SortDistance, rideSortMovingTime: rides.SortMovingTime, + rideSortSpeed: rides.SortSpeed, rideSortElevation: rides.SortElevation, rideSortCotacol: rides.SortCotacol, rideSortCotacolKm: rides.SortCotacolKm, @@ -189,6 +192,7 @@ func rideSortHeadersWithFilters(current RideSort, filters RideFilters) []RideSor {key: rideSortStarted, label: "Started"}, {key: rideSortDistance, label: "Distance", class: "numeric"}, {key: rideSortMovingTime, label: "Moving time", class: "numeric"}, + {key: rideSortSpeed, label: "Speed", class: "numeric"}, {key: rideSortElevation, label: "Elevation", class: "numeric"}, {key: rideSortCotacol, label: "Cotacol", class: "numeric"}, {key: rideSortCotacolKm, label: "Cotacol / 100 km", class: "numeric"}, @@ -355,6 +359,10 @@ func formatDistance(meters float64) string { return fmt.Sprintf("%.1f km", meters/1000) } +func formatSpeed(metersPerSecond float64) string { + return fmt.Sprintf("%.1f km/h", metersPerSecond*3.6) +} + func formatDuration(seconds int64) string { hours := seconds / 3600 minutes := (seconds % 3600) / 60 |
