@dgpholdings/greatoak-shared 1.1.20 → 1.1.22
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.
|
@@ -38,7 +38,7 @@ export type TExercise = {
|
|
|
38
38
|
primaryMuscles: TBodyPartKeys;
|
|
39
39
|
secondaryMuscles: TBodyPartKeys;
|
|
40
40
|
trainingTypes: TTrainingType[];
|
|
41
|
-
|
|
41
|
+
avgSetDurationInSecs?: number;
|
|
42
42
|
difficultyLevel: number;
|
|
43
43
|
hypertrophyLevel: number;
|
|
44
44
|
strengthGainLevel: number;
|
|
@@ -29,11 +29,11 @@ export type TRecordBodyWeight = Extract<TRecord, {
|
|
|
29
29
|
}>;
|
|
30
30
|
export type TRecordConfig = {
|
|
31
31
|
enableAuxWeight?: boolean;
|
|
32
|
-
enableRestTime?: boolean;
|
|
33
32
|
enableRir?: boolean;
|
|
34
33
|
enableRpe?: boolean;
|
|
35
34
|
enableSetNote?: boolean;
|
|
36
35
|
enableExerciseNote?: boolean;
|
|
36
|
+
enableRestTime?: boolean;
|
|
37
37
|
};
|
|
38
38
|
export type TApiExerciseRecordUpdateReq = {
|
|
39
39
|
templateId: string;
|
|
@@ -42,6 +42,7 @@ export type TApiExerciseRecordUpdateReq = {
|
|
|
42
42
|
exerciseId: string;
|
|
43
43
|
config: TRecordConfig;
|
|
44
44
|
exerciseNote: string;
|
|
45
|
+
restTimeSecs?: number;
|
|
45
46
|
record: TRecord[];
|
|
46
47
|
}[];
|
|
47
48
|
};
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { TRefinedRecord } from "./record.utils";
|
|
2
|
+
type TUserProfile = {
|
|
3
3
|
age?: number;
|
|
4
4
|
gender?: "male" | "female" | "non-binary" | "unspecified";
|
|
5
5
|
weightKg?: number;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* The score represents the training stimulus or workload stress generated by a specific set of exercise inputs.
|
|
9
|
+
* in short: Training Stress Score (TSS)
|
|
10
|
+
* We can use the score for:
|
|
11
|
+
1.Tracking session intensity or set difficulty over time
|
|
12
|
+
2. Deciding muscle recovery readiness
|
|
13
|
+
3. Creating training summaries, like:
|
|
14
|
+
- Daily workload
|
|
15
|
+
- Volume comparisons
|
|
16
|
+
- Weekly fatigue trends
|
|
17
|
+
*/
|
|
18
|
+
export declare const computeScoreFromRecord: (record: TRefinedRecord, userProfile?: TUserProfile) => number;
|
|
19
|
+
export {};
|
|
@@ -2,8 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.computeScoreFromRecord = void 0;
|
|
4
4
|
const time_util_1 = require("./time.util");
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The score represents the training stimulus or workload stress generated by a specific set of exercise inputs.
|
|
7
|
+
* in short: Training Stress Score (TSS)
|
|
8
|
+
* We can use the score for:
|
|
9
|
+
1.Tracking session intensity or set difficulty over time
|
|
10
|
+
2. Deciding muscle recovery readiness
|
|
11
|
+
3. Creating training summaries, like:
|
|
12
|
+
- Daily workload
|
|
13
|
+
- Volume comparisons
|
|
14
|
+
- Weekly fatigue trends
|
|
15
|
+
*/
|
|
16
|
+
const computeScoreFromRecord = (record, userProfile) => {
|
|
17
|
+
var _a, _b, _c, _d, _e, _f;
|
|
7
18
|
if (!record.isDone)
|
|
8
19
|
return 0;
|
|
9
20
|
// Determine load and effortFactor from record based on type
|
|
@@ -19,22 +30,20 @@ const computeScoreFromRecord = (record, recordType, userProfile) => {
|
|
|
19
30
|
effortFactor = 10 - rir; // lower RIR means more effort
|
|
20
31
|
}
|
|
21
32
|
// Step 2: Determine load
|
|
22
|
-
switch (
|
|
33
|
+
switch (record.type) {
|
|
23
34
|
case "weight-reps": {
|
|
24
|
-
|
|
25
|
-
const reps = (_d = record.reps) !== null && _d !== void 0 ? _d : 0;
|
|
26
|
-
load = kg * reps;
|
|
35
|
+
load = record.kg * record.reps;
|
|
27
36
|
break;
|
|
28
37
|
}
|
|
29
38
|
case "duration": {
|
|
30
|
-
const durationSecs = (0, time_util_1.mmssToSecs)((
|
|
31
|
-
const auxWeight = (
|
|
39
|
+
const durationSecs = (0, time_util_1.mmssToSecs)((_c = record.durationSecs) !== null && _c !== void 0 ? _c : "00:00");
|
|
40
|
+
const auxWeight = (_d = record.auxWeightKg) !== null && _d !== void 0 ? _d : 0;
|
|
32
41
|
load = auxWeight > 0 ? auxWeight * durationSecs : durationSecs;
|
|
33
42
|
break;
|
|
34
43
|
}
|
|
35
44
|
case "reps-only": {
|
|
36
|
-
const reps = (
|
|
37
|
-
const auxWeight = (
|
|
45
|
+
const reps = (_e = record.reps) !== null && _e !== void 0 ? _e : 0;
|
|
46
|
+
const auxWeight = (_f = record.auxWeightKg) !== null && _f !== void 0 ? _f : 0;
|
|
38
47
|
load = auxWeight > 0 ? auxWeight * reps : reps;
|
|
39
48
|
break;
|
|
40
49
|
}
|