Readme steps notation fix

master
mgifos 8 years ago
parent d1053e44dd
commit 9f8d07dc51
  1. 7
      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 ## 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 - 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 - 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) - Enter bin folder and run `quick-plan` command (use `quick-plan.bat` if you are a Windows user)
@ -72,13 +73,13 @@ The reserved keywords of the notation are: workout, warmup, cooldown, run, repea
**`<header>`** := `workout: <name>` **`<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` **`<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 => Http().singleRequest(req).flatMap { res =>
if (res.status == OK) if (res.status == OK)
res.body.map { json => 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]) arr.map(x => (x \ "workoutName").as[String] -> (x \ "workoutId").as[Long])
}.getOrElse(Seq.empty) }.getOrElse(Seq.empty)
x.groupBy { .groupBy { case (name, _) => name }
case (name, _) => name .map { case (a, b) => a -> b.map(_._2) }
}.map {
case (a, b) => a -> b.map(_._2)
}
} }
else { else {
log.debug(s"Cannot retrieve workout list, response: $res") log.debug(s"Cannot retrieve workout list, response: $res")

Loading…
Cancel
Save