Workout finishing fixed

This commit is contained in:
AG
2025-11-20 23:24:51 +02:00
parent 84417847fd
commit 12a79ae642
4 changed files with 31 additions and 28 deletions

View File

@@ -73,12 +73,13 @@ function App() {
setCurrentUser(updatedUser);
};
const handleStartSession = (plan?: WorkoutPlan) => {
const handleStartSession = (plan?: WorkoutPlan, startWeight?: number) => {
if (!currentUser) return;
// Get latest weight from profile or default
const profile = getCurrentUserProfile(currentUser.id);
const currentWeight = profile?.weight || 70;
// Use provided startWeight, or profile weight, or default 70
const currentWeight = startWeight || profile?.weight || 70;
const newSession: WorkoutSession = {
id: crypto.randomUUID(),
@@ -155,6 +156,7 @@ function App() {
{currentTab === 'TRACK' && (
<Tracker
userId={currentUser.id}
userWeight={currentUser.profile?.weight}
activeSession={activeSession}
activePlan={activePlan}
onSessionStart={handleStartSession}