fix(fitness): persist activityType when picking GPS activity
The active-workout activity picker updated local state + workout.name but never synced workout.activityType, so every hiking/walking/cycling workout was saved with an inner exercise of 'running'. That silently applied the wrong kcal model — running Minetti for hiking/walking (~43% overestimate) and running instead of the cycling physics model (large overestimate for cycling). Adds an activityType setter on the workout store and invokes it from selectActivity() so the saved session's exercise matches the picked activity.
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "homepage",
|
||||
"version": "1.37.5",
|
||||
"version": "1.37.6",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -714,6 +714,7 @@ export function createWorkout() {
|
||||
get paused() { return paused; },
|
||||
get mode() { return mode; },
|
||||
get activityType() { return activityType; },
|
||||
set activityType(v: GpsActivityType | null) { activityType = v; _persist(); },
|
||||
get name() { return name; },
|
||||
set name(v: string) { name = v; _persist(); },
|
||||
get templateId() { return templateId; },
|
||||
|
||||
@@ -252,6 +252,7 @@
|
||||
function selectActivity(/** @type {string} */ id) {
|
||||
selectedActivity = /** @type {import('$lib/js/workout.svelte').GpsActivityType} */ (id);
|
||||
const labels = { running: 'Running', walking: 'Walking', cycling: 'Cycling', hiking: 'Hiking' };
|
||||
workout.activityType = selectedActivity;
|
||||
workout.name = labels[selectedActivity] ?? 'GPS Workout';
|
||||
showActivityPicker = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user