Skip to content

Commit

Permalink
fix(frontend): duplicate the workout calories burnt as well
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnisDa committed Feb 1, 2025
1 parent 0e25b50 commit 664cde1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/frontend/app/lib/state/fitness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ export const useMergingExercise = () => useAtom(mergingExerciseAtom);
export const duplicateOldWorkout = async (
name: string,
fitnessEntity: FitnessAction,
caloriesBurnt: number | undefined,
workoutInformation: WorkoutInformation,
coreDetails: ReturnType<typeof useCoreDetails>,
userFitnessPreferences: UserFitnessPreferences,
Expand All @@ -307,11 +308,12 @@ export const duplicateOldWorkout = async (
) => {
const inProgress = getDefaultWorkout(fitnessEntity);
inProgress.name = name;
inProgress.repeatedFrom = params.repeatedFromId;
inProgress.caloriesBurnt = caloriesBurnt;
inProgress.templateId = params.templateId;
inProgress.repeatedFrom = params.repeatedFromId;
inProgress.updateWorkoutId = params.updateWorkoutId;
inProgress.updateWorkoutTemplateId = params.updateWorkoutTemplateId;
inProgress.comment = workoutInformation.comment || undefined;
inProgress.updateWorkoutTemplateId = params.updateWorkoutTemplateId;
for (const [exerciseIdx, ex] of workoutInformation.exercises.entries()) {
const sets = ex.sets.map((v) =>
convertHistorySetToCurrentSet(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ export default function Page() {
const workout = await duplicateOldWorkout(
loaderData.entityName,
params.action,
loaderData.caloriesBurnt ? Number(loaderData.caloriesBurnt) : undefined,
loaderData.information,
coreDetails,
userPreferences.fitness,
Expand Down

0 comments on commit 664cde1

Please sign in to comment.