@aneuhold/core-ts-db-lib 4.1.1 → 4.1.2
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/CHANGELOG.md +12 -0
- package/lib/services/workout/EquipmentType/WorkoutEquipmentTypeService.d.ts +16 -3
- package/lib/services/workout/EquipmentType/WorkoutEquipmentTypeService.d.ts.map +1 -1
- package/lib/services/workout/EquipmentType/WorkoutEquipmentTypeService.js +33 -3
- package/lib/services/workout/EquipmentType/WorkoutEquipmentTypeService.js.map +1 -1
- package/lib/services/workout/EquipmentType/WorkoutEquipmentTypeService.ts +35 -3
- package/lib/services/workout/ExerciseCalibration/WorkoutExerciseCalibrationService.d.ts +7 -0
- package/lib/services/workout/ExerciseCalibration/WorkoutExerciseCalibrationService.d.ts.map +1 -1
- package/lib/services/workout/ExerciseCalibration/WorkoutExerciseCalibrationService.js +10 -1
- package/lib/services/workout/ExerciseCalibration/WorkoutExerciseCalibrationService.js.map +1 -1
- package/lib/services/workout/ExerciseCalibration/WorkoutExerciseCalibrationService.ts +11 -1
- package/lib/services/workout/Microcycle/WorkoutMicrocycleService.d.ts.map +1 -1
- package/lib/services/workout/Microcycle/WorkoutMicrocycleService.js +29 -22
- package/lib/services/workout/Microcycle/WorkoutMicrocycleService.js.map +1 -1
- package/lib/services/workout/Microcycle/WorkoutMicrocycleService.ts +32 -26
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## 🔖 [4.1.2] (2026-02-15)
|
|
9
|
+
|
|
10
|
+
### ✅ Added
|
|
11
|
+
|
|
12
|
+
- Added `generatePlateWeightOptions()` method to `WorkoutEquipmentTypeService` to generate all achievable weight combinations from a bar and plate pairs.
|
|
13
|
+
- Added `get1RMRaw()` static method to `WorkoutExerciseCalibrationService` for calculating 1RM from weight and reps.
|
|
14
|
+
|
|
15
|
+
### 🏗️ Changed
|
|
16
|
+
|
|
17
|
+
- Refactored `generateSessionsForMicrocycle()` in `WorkoutMicrocycleService` to support creating more sessions than available non-rest days by distributing sessions chronologically across days.
|
|
18
|
+
|
|
8
19
|
## 🔖 [4.1.1] (2026-02-06)
|
|
9
20
|
|
|
10
21
|
### 🏗️ Changed
|
|
@@ -214,6 +225,7 @@ Updated dependency: now requires `@aneuhold/core-ts-lib@^2.3.11`.
|
|
|
214
225
|
|
|
215
226
|
<!-- Link References -->
|
|
216
227
|
|
|
228
|
+
[4.1.2]: https://github.com/aneuhold/ts-libs/compare/core-ts-db-lib-v4.1.1...core-ts-db-lib-v4.1.2
|
|
217
229
|
[4.1.1]: https://github.com/aneuhold/ts-libs/compare/core-ts-db-lib-v4.1.0...core-ts-db-lib-v4.1.1
|
|
218
230
|
[4.1.0]: https://github.com/aneuhold/ts-libs/compare/core-ts-db-lib-v4.0.4...core-ts-db-lib-v4.1.0
|
|
219
231
|
[4.0.4]: https://github.com/aneuhold/ts-libs/compare/core-ts-db-lib-v4.0.3...core-ts-db-lib-v4.0.4
|
|
@@ -9,14 +9,27 @@ export default class WorkoutEquipmentTypeService {
|
|
|
9
9
|
* Starts at minWeight (e.g., the bar weight), increments by increment (e.g., 2.5, 5, 10 lbs),
|
|
10
10
|
* and continues until maxWeight is reached or exceeded.
|
|
11
11
|
*
|
|
12
|
-
* This may be refactored / maybe a new method will be created in the future to handle a given
|
|
13
|
-
* set of weight plates to generate all possible combinations.
|
|
14
|
-
*
|
|
15
12
|
* @param minWeight The minimum weight (e.g., bar weight).
|
|
16
13
|
* @param increment The weight increment.
|
|
17
14
|
* @param maxWeight The maximum weight.
|
|
18
15
|
*/
|
|
19
16
|
static generateWeightOptions(minWeight: number, increment: number, maxWeight: number): number[];
|
|
17
|
+
/**
|
|
18
|
+
* Generates all achievable weights from a bar weight and a set of plate pairs.
|
|
19
|
+
*
|
|
20
|
+
* Each plate entry specifies a plate weight and the number of pairs available.
|
|
21
|
+
* Plates are added in pairs (both sides of the bar), so each plate adds
|
|
22
|
+
* `weight * 2` to the total. All combinations of plates are computed to
|
|
23
|
+
* produce the full set of achievable weights.
|
|
24
|
+
*
|
|
25
|
+
* @param barWeight The weight of the bar alone.
|
|
26
|
+
* @param plates Array of plate entries, each with a `weight` and `pairs` count.
|
|
27
|
+
* @returns Sorted, deduplicated array of all achievable weights.
|
|
28
|
+
*/
|
|
29
|
+
static generatePlateWeightOptions(barWeight: number, plates: Array<{
|
|
30
|
+
weight: number;
|
|
31
|
+
pairs: number;
|
|
32
|
+
}>): number[];
|
|
20
33
|
/**
|
|
21
34
|
* Finds the nearest available weight from equipmentType.weightOptions.
|
|
22
35
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkoutEquipmentTypeService.d.ts","sourceRoot":"","sources":["../../../../src/services/workout/EquipmentType/WorkoutEquipmentTypeService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAE/F;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,2BAA2B;IAC9C
|
|
1
|
+
{"version":3,"file":"WorkoutEquipmentTypeService.d.ts","sourceRoot":"","sources":["../../../../src/services/workout/EquipmentType/WorkoutEquipmentTypeService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAE/F;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,2BAA2B;IAC9C;;;;;;;;;OASG;IACH,MAAM,CAAC,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE;IAY/F;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,0BAA0B,CAC/B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,GAC/C,MAAM,EAAE;IAoBX;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,iBAAiB,CACtB,aAAa,EAAE,oBAAoB,EACnC,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,WAAW,GACjE,MAAM,GAAG,IAAI;CAyCjB"}
|
|
@@ -8,9 +8,6 @@ export default class WorkoutEquipmentTypeService {
|
|
|
8
8
|
* Starts at minWeight (e.g., the bar weight), increments by increment (e.g., 2.5, 5, 10 lbs),
|
|
9
9
|
* and continues until maxWeight is reached or exceeded.
|
|
10
10
|
*
|
|
11
|
-
* This may be refactored / maybe a new method will be created in the future to handle a given
|
|
12
|
-
* set of weight plates to generate all possible combinations.
|
|
13
|
-
*
|
|
14
11
|
* @param minWeight The minimum weight (e.g., bar weight).
|
|
15
12
|
* @param increment The weight increment.
|
|
16
13
|
* @param maxWeight The maximum weight.
|
|
@@ -24,6 +21,39 @@ export default class WorkoutEquipmentTypeService {
|
|
|
24
21
|
}
|
|
25
22
|
return weights;
|
|
26
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Generates all achievable weights from a bar weight and a set of plate pairs.
|
|
26
|
+
*
|
|
27
|
+
* Each plate entry specifies a plate weight and the number of pairs available.
|
|
28
|
+
* Plates are added in pairs (both sides of the bar), so each plate adds
|
|
29
|
+
* `weight * 2` to the total. All combinations of plates are computed to
|
|
30
|
+
* produce the full set of achievable weights.
|
|
31
|
+
*
|
|
32
|
+
* @param barWeight The weight of the bar alone.
|
|
33
|
+
* @param plates Array of plate entries, each with a `weight` and `pairs` count.
|
|
34
|
+
* @returns Sorted, deduplicated array of all achievable weights.
|
|
35
|
+
*/
|
|
36
|
+
static generatePlateWeightOptions(barWeight, plates) {
|
|
37
|
+
let additions = new Set([0]);
|
|
38
|
+
for (const plate of plates) {
|
|
39
|
+
if (plate.weight <= 0 || plate.pairs <= 0)
|
|
40
|
+
continue;
|
|
41
|
+
const expanded = [];
|
|
42
|
+
for (const existing of additions) {
|
|
43
|
+
for (let count = 1; count <= plate.pairs; count++) {
|
|
44
|
+
expanded.push(existing + plate.weight * 2 * count);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
additions = new Set([...additions, ...expanded]);
|
|
48
|
+
if (additions.size > 1000)
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
const weights = [...additions]
|
|
52
|
+
.map((a) => barWeight + a)
|
|
53
|
+
.filter((w) => w >= 0)
|
|
54
|
+
.sort((a, b) => a - b);
|
|
55
|
+
return [...new Set(weights)];
|
|
56
|
+
}
|
|
27
57
|
/**
|
|
28
58
|
* Finds the nearest available weight from equipmentType.weightOptions.
|
|
29
59
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkoutEquipmentTypeService.js","sourceRoot":"","sources":["../../../../src/services/workout/EquipmentType/WorkoutEquipmentTypeService.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,2BAA2B;IAC9C
|
|
1
|
+
{"version":3,"file":"WorkoutEquipmentTypeService.js","sourceRoot":"","sources":["../../../../src/services/workout/EquipmentType/WorkoutEquipmentTypeService.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,2BAA2B;IAC9C;;;;;;;;;OASG;IACH,MAAM,CAAC,qBAAqB,CAAC,SAAiB,EAAE,SAAiB,EAAE,SAAiB;QAClF,MAAM,OAAO,GAAa,EAAE,CAAC;QAC7B,IAAI,aAAa,GAAG,SAAS,CAAC;QAE9B,OAAO,aAAa,IAAI,SAAS,EAAE,CAAC;YAClC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAC5B,aAAa,IAAI,SAAS,CAAC;QAC7B,CAAC;QAED,OAAO,OAAO,CAA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AAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC;IACpD,CAAC;CACF"}
|
|
@@ -10,9 +10,6 @@ export default class WorkoutEquipmentTypeService {
|
|
|
10
10
|
* Starts at minWeight (e.g., the bar weight), increments by increment (e.g., 2.5, 5, 10 lbs),
|
|
11
11
|
* and continues until maxWeight is reached or exceeded.
|
|
12
12
|
*
|
|
13
|
-
* This may be refactored / maybe a new method will be created in the future to handle a given
|
|
14
|
-
* set of weight plates to generate all possible combinations.
|
|
15
|
-
*
|
|
16
13
|
* @param minWeight The minimum weight (e.g., bar weight).
|
|
17
14
|
* @param increment The weight increment.
|
|
18
15
|
* @param maxWeight The maximum weight.
|
|
@@ -29,6 +26,41 @@ export default class WorkoutEquipmentTypeService {
|
|
|
29
26
|
return weights;
|
|
30
27
|
}
|
|
31
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Generates all achievable weights from a bar weight and a set of plate pairs.
|
|
31
|
+
*
|
|
32
|
+
* Each plate entry specifies a plate weight and the number of pairs available.
|
|
33
|
+
* Plates are added in pairs (both sides of the bar), so each plate adds
|
|
34
|
+
* `weight * 2` to the total. All combinations of plates are computed to
|
|
35
|
+
* produce the full set of achievable weights.
|
|
36
|
+
*
|
|
37
|
+
* @param barWeight The weight of the bar alone.
|
|
38
|
+
* @param plates Array of plate entries, each with a `weight` and `pairs` count.
|
|
39
|
+
* @returns Sorted, deduplicated array of all achievable weights.
|
|
40
|
+
*/
|
|
41
|
+
static generatePlateWeightOptions(
|
|
42
|
+
barWeight: number,
|
|
43
|
+
plates: Array<{ weight: number; pairs: number }>
|
|
44
|
+
): number[] {
|
|
45
|
+
let additions = new Set<number>([0]);
|
|
46
|
+
for (const plate of plates) {
|
|
47
|
+
if (plate.weight <= 0 || plate.pairs <= 0) continue;
|
|
48
|
+
const expanded: number[] = [];
|
|
49
|
+
for (const existing of additions) {
|
|
50
|
+
for (let count = 1; count <= plate.pairs; count++) {
|
|
51
|
+
expanded.push(existing + plate.weight * 2 * count);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
additions = new Set([...additions, ...expanded]);
|
|
55
|
+
if (additions.size > 1000) break;
|
|
56
|
+
}
|
|
57
|
+
const weights = [...additions]
|
|
58
|
+
.map((a) => barWeight + a)
|
|
59
|
+
.filter((w) => w >= 0)
|
|
60
|
+
.sort((a, b) => a - b);
|
|
61
|
+
return [...new Set(weights)];
|
|
62
|
+
}
|
|
63
|
+
|
|
32
64
|
/**
|
|
33
65
|
* Finds the nearest available weight from equipmentType.weightOptions.
|
|
34
66
|
*
|
|
@@ -11,6 +11,13 @@ export default class WorkoutExerciseCalibrationService {
|
|
|
11
11
|
* @param calibration The workout exercise calibration.
|
|
12
12
|
*/
|
|
13
13
|
static get1RM(calibration: WorkoutExerciseCalibration): number;
|
|
14
|
+
/**
|
|
15
|
+
* Calculates the 1 Rep Max using the NASM formula based on provided weight and reps.
|
|
16
|
+
*
|
|
17
|
+
* @param weight The weight lifted.
|
|
18
|
+
* @param reps The number of reps performed.
|
|
19
|
+
*/
|
|
20
|
+
static get1RMRaw(weight: number, reps: number): number;
|
|
14
21
|
/**
|
|
15
22
|
* Calculates the target weight for a set based on target reps and 1RM.
|
|
16
23
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkoutExerciseCalibrationService.d.ts","sourceRoot":"","sources":["../../../../src/services/workout/ExerciseCalibration/WorkoutExerciseCalibrationService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0DAA0D,CAAC;AAE3G;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iCAAiC;IACpD;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,0BAA0B,GAAG,MAAM;IAI9D;;;;;;;;OAQG;IACH,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,0BAA0B,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM;IAM3F;;;;;;;;OAQG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;CAGnC"}
|
|
1
|
+
{"version":3,"file":"WorkoutExerciseCalibrationService.d.ts","sourceRoot":"","sources":["../../../../src/services/workout/ExerciseCalibration/WorkoutExerciseCalibrationService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0DAA0D,CAAC;AAE3G;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iCAAiC;IACpD;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,0BAA0B,GAAG,MAAM;IAI9D;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAItD;;;;;;;;OAQG;IACH,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,0BAA0B,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM;IAM3F;;;;;;;;OAQG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;CAGnC"}
|
|
@@ -10,7 +10,16 @@ export default class WorkoutExerciseCalibrationService {
|
|
|
10
10
|
* @param calibration The workout exercise calibration.
|
|
11
11
|
*/
|
|
12
12
|
static get1RM(calibration) {
|
|
13
|
-
return (calibration.weight
|
|
13
|
+
return this.get1RMRaw(calibration.weight, calibration.reps);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Calculates the 1 Rep Max using the NASM formula based on provided weight and reps.
|
|
17
|
+
*
|
|
18
|
+
* @param weight The weight lifted.
|
|
19
|
+
* @param reps The number of reps performed.
|
|
20
|
+
*/
|
|
21
|
+
static get1RMRaw(weight, reps) {
|
|
22
|
+
return (weight * reps) / 30.48 + weight;
|
|
14
23
|
}
|
|
15
24
|
/**
|
|
16
25
|
* Calculates the target weight for a set based on target reps and 1RM.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkoutExerciseCalibrationService.js","sourceRoot":"","sources":["../../../../src/services/workout/ExerciseCalibration/WorkoutExerciseCalibrationService.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iCAAiC;IACpD;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,WAAuC;QACnD,OAAO,CAAC,WAAW,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"WorkoutExerciseCalibrationService.js","sourceRoot":"","sources":["../../../../src/services/workout/ExerciseCalibration/WorkoutExerciseCalibrationService.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iCAAiC;IACpD;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,WAAuC;QACnD,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IAC9D,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,SAAS,CAAC,MAAc,EAAE,IAAY;QAC3C,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,KAAK,GAAG,MAAM,CAAC;IAC1C,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,eAAe,CAAC,WAAuC,EAAE,UAAkB;QAChF,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAC3C,MAAM,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAC9D,OAAO,CAAC,gBAAgB,GAAG,GAAG,CAAC,GAAG,SAAS,CAAC;IAC9C,CAAC;IAED;;;;;;;;OAQG;IACK,MAAM,CAAC,mBAAmB,CAAC,UAAkB;QACnD,OAAO,EAAE,GAAG,CAAC,UAAU,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;IACrC,CAAC;CACF"}
|
|
@@ -12,7 +12,17 @@ export default class WorkoutExerciseCalibrationService {
|
|
|
12
12
|
* @param calibration The workout exercise calibration.
|
|
13
13
|
*/
|
|
14
14
|
static get1RM(calibration: WorkoutExerciseCalibration): number {
|
|
15
|
-
return (calibration.weight
|
|
15
|
+
return this.get1RMRaw(calibration.weight, calibration.reps);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Calculates the 1 Rep Max using the NASM formula based on provided weight and reps.
|
|
20
|
+
*
|
|
21
|
+
* @param weight The weight lifted.
|
|
22
|
+
* @param reps The number of reps performed.
|
|
23
|
+
*/
|
|
24
|
+
static get1RMRaw(weight: number, reps: number): number {
|
|
25
|
+
return (weight * reps) / 30.48 + weight;
|
|
16
26
|
}
|
|
17
27
|
|
|
18
28
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkoutMicrocycleService.d.ts","sourceRoot":"","sources":["../../../../src/services/workout/Microcycle/WorkoutMicrocycleService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,+CAA+C,CAAC;AACvD,OAAO,KAAK,EACV,uBAAuB,EACvB,0BAA0B,EAC3B,MAAM,0DAA0D,CAAC;AAElE,OAAO,KAAK,2BAA2B,MAAM,6CAA6C,CAAC;AAI3F;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,wBAAwB;IAC3C;;OAEG;IACH,MAAM,CAAC,6BAA6B,CAAC,EACnC,OAAO,EACP,eAAe,EACf,SAAS,EACT,kBAAkB,EACnB,EAAE;QACD,OAAO,EAAE,2BAA2B,CAAC;QACrC,eAAe,EAAE,MAAM,CAAC;QACxB,SAAS,EAAE,MAAM,CAAC;QAClB,kBAAkB,EAAE,OAAO,CAAC;KAC7B,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"WorkoutMicrocycleService.d.ts","sourceRoot":"","sources":["../../../../src/services/workout/Microcycle/WorkoutMicrocycleService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,+CAA+C,CAAC;AACvD,OAAO,KAAK,EACV,uBAAuB,EACvB,0BAA0B,EAC3B,MAAM,0DAA0D,CAAC;AAElE,OAAO,KAAK,2BAA2B,MAAM,6CAA6C,CAAC;AAI3F;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,wBAAwB;IAC3C;;OAEG;IACH,MAAM,CAAC,6BAA6B,CAAC,EACnC,OAAO,EACP,eAAe,EACf,SAAS,EACT,kBAAkB,EACnB,EAAE;QACD,OAAO,EAAE,2BAA2B,CAAC;QACrC,eAAe,EAAE,MAAM,CAAC;QACxB,SAAS,EAAE,MAAM,CAAC;QAClB,kBAAkB,EAAE,OAAO,CAAC;KAC7B,GAAG,IAAI;IA8DR;;;;;;;OAOG;IACH,MAAM,CAAC,iCAAiC,CACtC,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,GAAG,CAAC,IAAI,EAAE,0BAA0B,CAAC,EACrD,WAAW,EAAE,GAAG,CAAC,IAAI,EAAE,eAAe,CAAC,GACtC,uBAAuB,EAAE,EAAE;CAuI/B"}
|
|
@@ -21,31 +21,38 @@ export default class WorkoutMicrocycleService {
|
|
|
21
21
|
}
|
|
22
22
|
const sessionsToExerciseSessionsArray = context.plannedSessionExercisePairs;
|
|
23
23
|
const setPlan = WorkoutVolumePlanningService.calculateSetPlanForMicrocycle(context, microcycleIndex, isDeloadMicrocycle);
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
// Build list of non-rest day dates
|
|
25
|
+
const nonRestDayDates = [];
|
|
26
|
+
let currentDate = new Date(microcycle.startDate);
|
|
26
27
|
for (let day = 0; day < mesocycle.plannedMicrocycleLengthInDays; day++) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
currentSessionDate = DateService.addDays(currentSessionDate, 1);
|
|
30
|
-
continue;
|
|
28
|
+
if (!mesocycle.plannedMicrocycleRestDays.includes(day)) {
|
|
29
|
+
nonRestDayDates.push(new Date(currentDate));
|
|
31
30
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
currentDate = DateService.addDays(currentDate, 1);
|
|
32
|
+
}
|
|
33
|
+
// Distribute sessions across non-rest days chronologically. If there are
|
|
34
|
+
// more sessions than non-rest days, the earliest days get extra sessions.
|
|
35
|
+
const totalSessions = mesocycle.plannedSessionCountPerMicrocycle;
|
|
36
|
+
const dayCount = nonRestDayDates.length;
|
|
37
|
+
const basePerDay = Math.floor(totalSessions / dayCount);
|
|
38
|
+
const remainder = totalSessions % dayCount;
|
|
39
|
+
let sessionIndex = 0;
|
|
40
|
+
for (let dayIndex = 0; dayIndex < dayCount; dayIndex++) {
|
|
41
|
+
const sessionsOnThisDay = basePerDay + (dayIndex < remainder ? 1 : 0);
|
|
42
|
+
for (let s = 0; s < sessionsOnThisDay; s++) {
|
|
43
|
+
const sessionExerciseList = sessionsToExerciseSessionsArray[sessionIndex] || [];
|
|
44
|
+
WorkoutSessionService.generateSession({
|
|
45
|
+
context,
|
|
46
|
+
microcycleIndex,
|
|
47
|
+
sessionIndex,
|
|
48
|
+
sessionStartDate: nonRestDayDates[dayIndex],
|
|
49
|
+
sessionExerciseList,
|
|
50
|
+
targetRir,
|
|
51
|
+
isDeloadMicrocycle,
|
|
52
|
+
setPlan
|
|
53
|
+
});
|
|
54
|
+
sessionIndex++;
|
|
35
55
|
}
|
|
36
|
-
const sessionExerciseList = sessionsToExerciseSessionsArray[sessionIndex] || [];
|
|
37
|
-
WorkoutSessionService.generateSession({
|
|
38
|
-
context,
|
|
39
|
-
microcycleIndex,
|
|
40
|
-
sessionIndex,
|
|
41
|
-
sessionStartDate: currentSessionDate,
|
|
42
|
-
sessionExerciseList,
|
|
43
|
-
targetRir,
|
|
44
|
-
isDeloadMicrocycle,
|
|
45
|
-
setPlan
|
|
46
|
-
});
|
|
47
|
-
sessionIndex++;
|
|
48
|
-
currentSessionDate = DateService.addDays(currentSessionDate, 1);
|
|
49
56
|
}
|
|
50
57
|
}
|
|
51
58
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkoutMicrocycleService.js","sourceRoot":"","sources":["../../../../src/services/workout/Microcycle/WorkoutMicrocycleService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EACL,gBAAgB,EAEjB,MAAM,+CAA+C,CAAC;AAKvD,OAAO,sBAAsB,MAAM,uCAAuC,CAAC;AAE3E,OAAO,qBAAqB,MAAM,qCAAqC,CAAC;AACxE,OAAO,4BAA4B,MAAM,wDAAwD,CAAC;AAElG;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,wBAAwB;IAC3C;;OAEG;IACH,MAAM,CAAC,6BAA6B,CAAC,EACnC,OAAO,EACP,eAAe,EACf,SAAS,EACT,kBAAkB,EAMnB;QACC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QACpC,MAAM,UAAU,GAAG,OAAO,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;QAE/D,IAAI,CAAC,OAAO,CAAC,2BAA2B,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CACb,2HAA2H,CAC5H,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,6BAA6B,EAAE,CAAC;YAC3C,MAAM,IAAI,KAAK,CACb,uJAAuJ,CACxJ,CAAC;QACJ,CAAC;QAED,MAAM,+BAA+B,GAAG,OAAO,CAAC,2BAA2B,CAAC;QAE5E,MAAM,OAAO,GAAG,4BAA4B,CAAC,6BAA6B,CACxE,OAAO,EACP,eAAe,EACf,kBAAkB,CACnB,CAAC;QAEF,IAAI,
|
|
1
|
+
{"version":3,"file":"WorkoutMicrocycleService.js","sourceRoot":"","sources":["../../../../src/services/workout/Microcycle/WorkoutMicrocycleService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EACL,gBAAgB,EAEjB,MAAM,+CA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|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
// Build list of non-rest day dates
|
|
57
|
+
const nonRestDayDates: Date[] = [];
|
|
58
|
+
let currentDate = new Date(microcycle.startDate);
|
|
59
59
|
for (let day = 0; day < mesocycle.plannedMicrocycleLengthInDays; day++) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
currentSessionDate = DateService.addDays(currentSessionDate, 1);
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// Stop if we've created all planned sessions
|
|
67
|
-
if (sessionIndex >= mesocycle.plannedSessionCountPerMicrocycle) {
|
|
68
|
-
break;
|
|
60
|
+
if (!mesocycle.plannedMicrocycleRestDays.includes(day)) {
|
|
61
|
+
nonRestDayDates.push(new Date(currentDate));
|
|
69
62
|
}
|
|
63
|
+
currentDate = DateService.addDays(currentDate, 1);
|
|
64
|
+
}
|
|
70
65
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
sessionStartDate: currentSessionDate,
|
|
78
|
-
sessionExerciseList,
|
|
79
|
-
targetRir,
|
|
80
|
-
isDeloadMicrocycle,
|
|
81
|
-
setPlan
|
|
82
|
-
});
|
|
66
|
+
// Distribute sessions across non-rest days chronologically. If there are
|
|
67
|
+
// more sessions than non-rest days, the earliest days get extra sessions.
|
|
68
|
+
const totalSessions = mesocycle.plannedSessionCountPerMicrocycle;
|
|
69
|
+
const dayCount = nonRestDayDates.length;
|
|
70
|
+
const basePerDay = Math.floor(totalSessions / dayCount);
|
|
71
|
+
const remainder = totalSessions % dayCount;
|
|
83
72
|
|
|
84
|
-
|
|
85
|
-
|
|
73
|
+
let sessionIndex = 0;
|
|
74
|
+
for (let dayIndex = 0; dayIndex < dayCount; dayIndex++) {
|
|
75
|
+
const sessionsOnThisDay = basePerDay + (dayIndex < remainder ? 1 : 0);
|
|
76
|
+
for (let s = 0; s < sessionsOnThisDay; s++) {
|
|
77
|
+
const sessionExerciseList = sessionsToExerciseSessionsArray[sessionIndex] || [];
|
|
78
|
+
|
|
79
|
+
WorkoutSessionService.generateSession({
|
|
80
|
+
context,
|
|
81
|
+
microcycleIndex,
|
|
82
|
+
sessionIndex,
|
|
83
|
+
sessionStartDate: nonRestDayDates[dayIndex],
|
|
84
|
+
sessionExerciseList,
|
|
85
|
+
targetRir,
|
|
86
|
+
isDeloadMicrocycle,
|
|
87
|
+
setPlan
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
sessionIndex++;
|
|
91
|
+
}
|
|
86
92
|
}
|
|
87
93
|
}
|
|
88
94
|
|
package/package.json
CHANGED