-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added more stats and moved them to basics tab chart mode
- Loading branch information
1 parent
f84fa95
commit 59f7216
Showing
5 changed files
with
102 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
import type { RouterOutputs } from '$lib/trpc/router'; | ||
|
||
export type WorkoutsOfMesocycle = NonNullable<RouterOutputs['mesocycles']['findById']>['workoutsOfMesocycle']; | ||
export type WorkoutExercise = WorkoutsOfMesocycle[number]['workout']['workoutExercises'][number]; | ||
export type Mesocycle = NonNullable<RouterOutputs['mesocycles']['findById']>; | ||
export type WorkoutsOfMesocycle = Mesocycle['workoutsOfMesocycle']; | ||
export type Workout = WorkoutsOfMesocycle[number]['workout']; | ||
export type WorkoutExercise = Workout['workoutExercises'][number]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
import { arraySum } from '$lib/utils'; | ||
import type { WorkoutExercise } from './types'; | ||
|
||
export function getExerciseVolume(workoutExercise: WorkoutExercise, userBodyweight: number) { | ||
return arraySum( | ||
workoutExercise.sets.map((set) => getSetVolume(set, userBodyweight, workoutExercise.bodyweightFraction)) | ||
); | ||
} | ||
import type { Workout, WorkoutExercise } from './types'; | ||
|
||
export function getSetVolume( | ||
set: WorkoutExercise['sets'][number], | ||
userBodyweight: number, | ||
bodyweightFraction: number | null | ||
) { | ||
// TODO: Mini sets? | ||
// TODO: Mini sets? | ||
return (set.reps + set.RIR) * set.load + (bodyweightFraction ?? 0) * userBodyweight; | ||
} | ||
|
||
export function getExerciseVolume(workoutExercise: WorkoutExercise, userBodyweight: number) { | ||
return arraySum( | ||
workoutExercise.sets.map((set) => getSetVolume(set, userBodyweight, workoutExercise.bodyweightFraction)) | ||
); | ||
} | ||
|
||
export function getWorkoutVolume(workout: Workout) { | ||
return arraySum(workout.workoutExercises.map((exercise) => getExerciseVolume(exercise, workout.userBodyweight))); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters