Recognize "Ramp" intervals

This commit is contained in:
Rene Saarsoo 2021-03-21 14:51:32 +02:00
parent 198d678ccd
commit cec3c57477
2 changed files with 15 additions and 2 deletions

View File

@ -231,6 +231,7 @@ Name: My Workout
Warmup: 5:30 50%..80% 100rpm
Cooldown: 5:30 70%..45%
Ramp: 5:30 90%..100%
`).intervals,
).toMatchInlineSnapshot(`
Array [
@ -258,6 +259,18 @@ Cooldown: 5:30 70%..45%
},
"type": "Cooldown",
},
Object {
"cadence": undefined,
"comments": Array [],
"duration": Duration {
"seconds": 330,
},
"intensity": RangeIntensity {
"_end": 1,
"_start": 0.9,
},
"type": "Ramp",
},
]
`);
});

View File

@ -1,13 +1,13 @@
import { ParseError } from "./ParseError";
export type HeaderType = "Name" | "Author" | "Description" | "Tags";
export type IntervalType = "Warmup" | "Rest" | "Interval" | "Cooldown" | "FreeRide";
export type IntervalType = "Warmup" | "Rest" | "Interval" | "Cooldown" | "FreeRide" | "Ramp";
const isHeaderType = (value: string): value is HeaderType => {
return ["Name", "Author", "Description", "Tags"].includes(value);
};
const isIntervalType = (value: string): value is IntervalType => {
return ["Warmup", "Rest", "Interval", "Cooldown", "FreeRide"].includes(value);
return ["Warmup", "Rest", "Interval", "Cooldown", "FreeRide", "Ramp"].includes(value);
};
// 0-based row and column indexes. First line is 0th.