Skip to content

Commit

Permalink
fix Training page require reload to progress
Browse files Browse the repository at this point in the history
  • Loading branch information
sametaln committed Dec 16, 2024
1 parent e8bf661 commit a9226a5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
1 change: 1 addition & 0 deletions frontend/src/components/Detailed_Ex_Modal.component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ const DetailedExModal = ({ isOpen, onClose, data, setData, excersizeID }) => {
return {
...exercise,
completedAt: new Date().toISOString(), // Mark as completed
completedSets: parsedSetInputs,
};
}
return exercise;
Expand Down
4 changes: 0 additions & 4 deletions frontend/src/components/Training.component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,18 +256,14 @@ const TrainingCard = () => {
onWorkoutOpen();
};

console.log(isUserJoined);
// Add a new utility function to check workout completion
const isWorkoutComplete = (workout) => {
return workout.workoutExercises.every(exercise => exercise.completedAt !== null);
};

// Add a new utility function to check week completion
const isWeekComplete = (week) => {
return week.workouts.every(workout => isWorkoutComplete(workout));
};


return (
<div className="w-full max-w-[60%] mx-auto p-4 bg-white shadow-lg rounded-lg text-sm">

Expand Down

0 comments on commit a9226a5

Please sign in to comment.