Readme steps notation fix

master
mgifos 8 years ago
parent d1053e44dd
commit 9f8d07dc51
  1. 11
      README.md
  2. 9
      src/main/scala/com.github.mgifos.workouts/GarminConnect.scala

@ -29,6 +29,7 @@ Checkout a [complete training plan for 80K ultra](https://docs.google.com/spread
## Installation
- Java 8 is a prerequisite, make sure you have it installed
- Go to the [releases page](https://github.com/mgifos/quick-plan/releases) of this project
- Download latest release zip file and unzip it somewhere on your computer
- Enter bin folder and run `quick-plan` command (use `quick-plan.bat` if you are a Windows user)
@ -68,17 +69,17 @@ 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, repeat, recover and lap-button.
**`<workout>`** := `<header> <step>+`
**`<workout>`** := `<header><step>+`
**`<header>`** := `workout: <name>`
**`<step>`** := `<newline> - <step-def>*`
**`<step>`** := `<newline>- <step-def>`
**`<step-def>`** := `<simple-step> | <repetition-step> `
**`<step-def>`** := `<simple-step> | <repetition-step>`
**`<repetition-step>`** := `repeat: <count> <step>+`
**`<simple-step>`** := `(warmup | cooldown | run | recover): <duration> [@ <target>]`
**`<simple-step>`** := `- (warmup | cooldown | run | recover): <duration> [@ <target>]`
**`<repetition-step>`** := `repeat: <count>(<newline> - <simple-step>)+`
**`<duration>`** := `<distance-duration> | <time-duration> | lap-button`

@ -152,14 +152,11 @@ class GarminConnect(email: String, password: String)(implicit system: ActorSyste
Http().singleRequest(req).flatMap { res =>
if (res.status == OK)
res.body.map { json =>
val x = Json.parse(json).asOpt[Seq[JsObject]].map { arr =>
Json.parse(json).asOpt[Seq[JsObject]].map { arr =>
arr.map(x => (x \ "workoutName").as[String] -> (x \ "workoutId").as[Long])
}.getOrElse(Seq.empty)
x.groupBy {
case (name, _) => name
}.map {
case (a, b) => a -> b.map(_._2)
}
.groupBy { case (name, _) => name }
.map { case (a, b) => a -> b.map(_._2) }
}
else {
log.debug(s"Cannot retrieve workout list, response: $res")

Loading…
Cancel
Save