jovandeginste / workout-tracker

A workout tracking web application for personal use (or family, friends), geared towards running and other GPX-based activities
Other
945 stars 31 forks source link

ui: show either speed or tempo on the stats page depending on workout type #251

Closed pixelspark closed 1 month ago

pixelspark commented 1 month ago

Tempo makes more sense for running.

jovandeginste commented 1 month ago

I would suggest to use an actual Go function here, similar to the preferred units. This would be useful in other places, like the "details" in the workout list table (which now only shows speed).

pixelspark commented 1 month ago

Yeah, that was my first attempt, but I abandoned that as (1) the function needs access to both the user profile (preferred units), workout type, and the speed value, which is a bit cumbersome, and (2) it's generating HTML (<abbr title=...>) and it didn't seem very clean to put this on the Go side. Also (3) the templates functions couldn't import the UserPreferredUnits struct due to some stupid import loop (probably fixable).

If you prefer though I can change it to a function, it would then become something like this:

{{ HumanTempoOrSpeed .AverageSpeed.Value .WorkoutType.String .UserPreferredUnits }}
jovandeginste commented 1 month ago

I'll give it a little try myself first...

By the way, translations are via Weblate now

jovandeginste commented 1 month ago

I would appreciate you taking a look at / testing out my version...