Generate <Ramp> tags in ZWO
- When range-interval at start: generate <Warmup> - When range-interval at end: generate <Cooldown> - Otherwise use <Ramp>
This commit is contained in:
parent
cec3c57477
commit
6bbdea1908
|
|
@ -117,7 +117,6 @@ console.log(stats(workout));
|
|||
- More restricted syntax for text (with quotes)
|
||||
- Concatenate similar intervals
|
||||
- Distinguish between terrain-sensitive and insensitive free-ride.
|
||||
- Use `<Ramp>` in addition to `<Warmup>` and `<Cooldown>`
|
||||
|
||||
[zwift]: https://zwift.com/
|
||||
[zwofactory]: https://zwofactory.com/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
Name: Ramps
|
||||
Author: R.Saarsoo
|
||||
Description:
|
||||
Various kinds of ramp intervals.
|
||||
|
||||
Ramp: 5:00 40%..75%
|
||||
|
||||
Ramp: 10:00 80%..90%
|
||||
Ramp: 10:00 90%..80%
|
||||
|
||||
Warmup: 10:00 80%..90%
|
||||
Cooldown: 10:00 90%..80%
|
||||
|
||||
Ramp: 5:00 75%..40%
|
||||
|
|
@ -11,7 +11,7 @@ const generateTextEvents = (comments: Comment[]): xml.XmlObject[] => {
|
|||
};
|
||||
|
||||
const generateRangeInterval = (
|
||||
tagName: "Warmup" | "Cooldown",
|
||||
tagName: "Warmup" | "Cooldown" | "Ramp",
|
||||
{ duration, intensity, cadence, comments }: Interval,
|
||||
): xml.XmlObject => {
|
||||
return {
|
||||
|
|
@ -79,16 +79,22 @@ const generateRepeatInterval = (repInterval: RepeatedInterval): xml.XmlObject =>
|
|||
};
|
||||
};
|
||||
|
||||
const generateInterval = (interval: Interval | RepeatedInterval): xml.XmlObject => {
|
||||
const generateInterval = (
|
||||
interval: Interval | RepeatedInterval,
|
||||
index: number,
|
||||
allIntervals: (Interval | RepeatedInterval)[],
|
||||
): xml.XmlObject => {
|
||||
if (interval.type === "repeat") {
|
||||
return generateRepeatInterval(interval);
|
||||
}
|
||||
|
||||
const { intensity } = interval;
|
||||
if (intensity.start < intensity.end) {
|
||||
if (index === 0 && intensity.start < intensity.end) {
|
||||
return generateRangeInterval("Warmup", interval);
|
||||
} else if (intensity.start > intensity.end) {
|
||||
} else if (index === allIntervals.length - 1 && intensity.start > intensity.end) {
|
||||
return generateRangeInterval("Cooldown", interval);
|
||||
} else if (intensity.start !== intensity.end) {
|
||||
return generateRangeInterval("Ramp", interval);
|
||||
} else if (intensity.zone === "free") {
|
||||
return generateFreeRideInterval(interval);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -226,6 +226,31 @@ The workouts are alphabetically ordered from easiest to hardest, so enjoy the mi
|
|||
</workout_file>"
|
||||
`;
|
||||
|
||||
exports[`Generate ZWO examples/ramps.txt 1`] = `
|
||||
"<workout_file>
|
||||
<name>Ramps</name>
|
||||
<author>R.Saarsoo</author>
|
||||
<description>Various kinds of ramp intervals.</description>
|
||||
<tags>
|
||||
</tags>
|
||||
<sportType>bike</sportType>
|
||||
<workout>
|
||||
<Warmup Duration=\\"300\\" PowerLow=\\"0.4\\" PowerHigh=\\"0.75\\">
|
||||
</Warmup>
|
||||
<Ramp Duration=\\"600\\" PowerLow=\\"0.8\\" PowerHigh=\\"0.9\\">
|
||||
</Ramp>
|
||||
<Ramp Duration=\\"600\\" PowerLow=\\"0.9\\" PowerHigh=\\"0.8\\">
|
||||
</Ramp>
|
||||
<Ramp Duration=\\"600\\" PowerLow=\\"0.8\\" PowerHigh=\\"0.9\\">
|
||||
</Ramp>
|
||||
<Ramp Duration=\\"600\\" PowerLow=\\"0.9\\" PowerHigh=\\"0.8\\">
|
||||
</Ramp>
|
||||
<Cooldown Duration=\\"300\\" PowerLow=\\"0.75\\" PowerHigh=\\"0.4\\">
|
||||
</Cooldown>
|
||||
</workout>
|
||||
</workout_file>"
|
||||
`;
|
||||
|
||||
exports[`Generate ZWO examples/threshold-pushing.txt 1`] = `
|
||||
"<workout_file>
|
||||
<name>Threshold pushing</name>
|
||||
|
|
@ -338,6 +363,27 @@ Zone Distribution:
|
|||
"
|
||||
`;
|
||||
|
||||
exports[`Generate stats examples/ramps.txt 1`] = `
|
||||
"
|
||||
Total duration: 50 minutes
|
||||
|
||||
Average intensity: 80%
|
||||
Normalized intensity: 82%
|
||||
|
||||
TSS: 56
|
||||
XP: 300
|
||||
|
||||
Zone Distribution:
|
||||
6 min - Z1: Recovery
|
||||
4 min - Z2: Endurance
|
||||
40 min - Z3: Tempo
|
||||
0 min - Z4: Threshold
|
||||
0 min - Z5: VO2 Max
|
||||
0 min - Z6: Anaerobic
|
||||
0 min - Freeride
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`Generate stats examples/threshold-pushing.txt 1`] = `
|
||||
"
|
||||
Total duration: 79 minutes
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ const filenames = [
|
|||
"examples/ftp-test.txt",
|
||||
"examples/halvfems.txt",
|
||||
"examples/threshold-pushing.txt",
|
||||
"examples/ramps.txt",
|
||||
];
|
||||
|
||||
describe("Generate ZWO", () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue