Additional step type 'go' provided to support custom workouts fully #29

master
mgifos 7 years ago
parent 611f6babc9
commit 55e1c1afb1
  1. 6
      README.md
  2. 2
      src/main/scala/com.github.mgifos.workouts/model/Step.scala
  3. 2
      src/test/scala/com/github/mgifos/workouts/model/StepSpec.scala

@ -69,7 +69,7 @@ quick-plan schedule -n 2018-04-29 -x -e your-mail-address@example.com ultra-80k-
```
## Workout notation
The reserved keywords of the notation are: workout, warmup, cooldown, run, bike, repeat, recover and lap-button.
The reserved keywords of the notation are: workout, warmup, cooldown, run, bike, go, repeat, recover and lap-button.
**`<workout>`** := `<header><step>+`
@ -83,7 +83,7 @@ The reserved keywords of the notation are: workout, warmup, cooldown, run, bike,
**`<step-def>`** := `<simple-step> | <repetition-step>`
**`<simple-step>`** := `(warmup | cooldown | run | bike | recover): <duration> [@ <target>]`
**`<simple-step>`** := `(warmup | cooldown | run | bike | go | recover): <duration> [@ <target>]`
**`<repetition-step>`** := `repeat: <count>(<newline> - <simple-step>)+`
@ -126,6 +126,6 @@ If not specified -m value from configuration will be used ('metric' by default).
## Known issues
- It is highly recommanded to use Google Spreadsheets or LibreOffice Calc to edit CSV files, as they both force line-feed (LF)
- It is highly recommended to use Google Spreadsheets or LibreOffice Calc to edit CSV files, as they both force line-feed (LF)
instead of carriage-return (CR) character for internal line breaks when defining workouts.
The parser we use is not able to parse CR values within the quoted values at the moment.

@ -70,7 +70,7 @@ object Step {
private def parseDurationStep(x: String)(implicit msys: MeasurementSystems.MeasurementSystem): DurationStep = x match {
case StepHeader(name, params) => name match {
case "warmup" => WarmupStep.tupled(expect(params))
case "run" | "bike" => IntervalStep.tupled(expect(params))
case "run" | "bike" | "go" => IntervalStep.tupled(expect(params))
case "recover" => RecoverStep.tupled(expect(params))
case "cooldown" => CooldownStep.tupled(expect(params))
case _ => throw new IllegalArgumentException(s"Duration step type was expected, $name")

@ -14,6 +14,8 @@ class StepSpec extends FlatSpec with Matchers {
Step.parse("- warmup: 5km") should be(WarmupStep(DistanceDuration(5, km)))
Step.parse("- run: 2km @ 5:00-4:50") should be(IntervalStep(DistanceDuration(2, km), Some(PaceTarget(Pace(msys.distance, "5:00"), Pace(msys.distance, "4:50")))))
Step.parse("- bike: 2km @ 20-30 kph") should be(IntervalStep(DistanceDuration(2, km), Some(SpeedTarget(Speed(msys.distance, "20"), Speed(msys.distance, "30")))))
Step.parse("- go: 20km @ 9:00-11:00") should be(IntervalStep(DistanceDuration(20, km), Some(PaceTarget(Pace(msys.distance, "9:00"), Pace(msys.distance, "11:00")))))
Step.parse("- recover: 500m @z2") should be(RecoverStep(DistanceDuration(500, m), Some(HrZoneTarget(2))))
Step.parse("- cooldown: 05:00") should be(CooldownStep(TimeDuration(minutes = 5)))
Step.parse("- repeat: 3\n - run: 10km\n - recover: 100m") should be(RepeatStep(3, List(

Loading…
Cancel
Save