From d09560fbf444099757bb4669953b6bf31ccab27a Mon Sep 17 00:00:00 2001 From: WhyAsh5114 Date: Wed, 23 Oct 2024 13:27:27 +0530 Subject: [PATCH] fix: tag exercises by their splitDayIndex during grouping to fix incorrect mesocycle stats --- src/lib/utils/mesocycleUtils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/utils/mesocycleUtils.ts b/src/lib/utils/mesocycleUtils.ts index fe905c4f..093fa18c 100644 --- a/src/lib/utils/mesocycleUtils.ts +++ b/src/lib/utils/mesocycleUtils.ts @@ -42,7 +42,9 @@ export function getAveragePercentageChangeOfExercisePerformances( } export function generatePerformanceChangesPerMuscleGroup(workoutsOfMesocycle: WorkoutsOfMesocycle) { - const allExercises = workoutsOfMesocycle.flatMap((wm) => wm.workout.workoutExercises); + const allExercises = workoutsOfMesocycle.flatMap((wm) => + wm.workout.workoutExercises.map((exercise) => ({ ...exercise, name: exercise.name + wm.splitDayIndex.toString() })) + ); const groupedExercisesByMuscleGroup = groupExercisesByMuscleGroup(allExercises); const fullyGroupedExercises = groupedExercisesByMuscleGroup.map(({ muscleGroup, exercises }) => ({