hevy-shared 1.0.887 → 1.0.889
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/built/hevyTrainer.js +40 -3
- package/package.json +1 -1
package/built/hevyTrainer.js
CHANGED
|
@@ -87,6 +87,38 @@ const normalizeExerciseCategory = (exercise) => {
|
|
|
87
87
|
: 'compound';
|
|
88
88
|
};
|
|
89
89
|
exports.normalizeExerciseCategory = normalizeExerciseCategory;
|
|
90
|
+
/**
|
|
91
|
+
* Returns true if the focus muscle group extra exercise is allowed for a given template
|
|
92
|
+
*/
|
|
93
|
+
const isFocusMuscleExtraExerciseAllowed = (templateName, focusMuscle) => {
|
|
94
|
+
const isFullBodyTemplate = templateName.startsWith('full_body');
|
|
95
|
+
// Full body templates allow all muscle groups
|
|
96
|
+
if (isFullBodyTemplate) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
const isLegsTemplate = templateName.startsWith('legs');
|
|
100
|
+
const isUpperTemplate = templateName.startsWith('upper');
|
|
101
|
+
const isLowerTemplate = templateName.startsWith('lower');
|
|
102
|
+
const isPushTemplate = templateName.startsWith('push');
|
|
103
|
+
const isPullTemplate = templateName.startsWith('pull');
|
|
104
|
+
switch (focusMuscle) {
|
|
105
|
+
case 'core':
|
|
106
|
+
// Core exercises are allowed for all templates
|
|
107
|
+
return true;
|
|
108
|
+
case 'chest':
|
|
109
|
+
case 'shoulders':
|
|
110
|
+
return isUpperTemplate || isPushTemplate;
|
|
111
|
+
case 'arms':
|
|
112
|
+
return isUpperTemplate || isPullTemplate || isPushTemplate;
|
|
113
|
+
case 'legs':
|
|
114
|
+
return isLowerTemplate || isLegsTemplate;
|
|
115
|
+
case 'back':
|
|
116
|
+
return isUpperTemplate || isPullTemplate;
|
|
117
|
+
default:
|
|
118
|
+
(0, _1.exhaustiveTypeCheck)(focusMuscle);
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
};
|
|
90
122
|
/**
|
|
91
123
|
* Checks if an exercise is compatible with the user's equipments
|
|
92
124
|
*
|
|
@@ -174,13 +206,17 @@ const getPrioritySortedExercises = (exercisePriorities, exerciseStore) => {
|
|
|
174
206
|
return sortedExercises;
|
|
175
207
|
};
|
|
176
208
|
exports.getPrioritySortedExercises = getPrioritySortedExercises;
|
|
177
|
-
const getMuscleGroup = ({ muscleGroupPrescription, programFocusMuscleExerciseCount, focusMuscle, }) => {
|
|
209
|
+
const getMuscleGroup = ({ muscleGroupPrescription, programFocusMuscleExerciseCount, focusMuscle, routineName, }) => {
|
|
178
210
|
if (muscleGroupPrescription === 'focus_muscle') {
|
|
179
|
-
|
|
211
|
+
// If the user has selected a focus muscle and it is allowed for the routine,
|
|
212
|
+
// we return the focus muscle extra exercise
|
|
213
|
+
if (!!focusMuscle &&
|
|
214
|
+
isFocusMuscleExtraExerciseAllowed(routineName, focusMuscle)) {
|
|
180
215
|
const n = _1.simplifiedMuscleGroupToMuscleGroups[focusMuscle].length;
|
|
181
216
|
return _1.simplifiedMuscleGroupToMuscleGroups[focusMuscle][programFocusMuscleExerciseCount % n];
|
|
182
217
|
}
|
|
183
|
-
//
|
|
218
|
+
// If the user has not selected a focus muscle or it is not allowed for the routine
|
|
219
|
+
// we skip this extra exercise for the focus muscle in the program
|
|
184
220
|
return undefined;
|
|
185
221
|
}
|
|
186
222
|
return muscleGroupPrescription;
|
|
@@ -301,6 +337,7 @@ const generateProgram = (params) => {
|
|
|
301
337
|
muscleGroupPrescription: exercisePrescription.muscle_group,
|
|
302
338
|
programFocusMuscleExerciseCount,
|
|
303
339
|
focusMuscle,
|
|
340
|
+
routineName: routine,
|
|
304
341
|
});
|
|
305
342
|
// If the muscle group is not found, skip the exercise
|
|
306
343
|
if (!muscleGroup) {
|