From 9f8d07dc519f27c31d345d0839397ab0cb42e809 Mon Sep 17 00:00:00 2001 From: mgifos Date: Sun, 1 Apr 2018 16:12:19 +0200 Subject: [PATCH] Readme steps notation fix --- README.md | 11 ++++++----- .../com.github.mgifos.workouts/GarminConnect.scala | 9 +++------ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 4f1e978..545e151 100644 --- a/README.md +++ b/README.md @@ -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: ` -**``** := ` - *` +**``** := `- ` -**``** := ` | ` +**``** := ` | ` -**``** := `repeat: +` +**``** := `(warmup | cooldown | run | recover): [@ ]` -**``** := `- (warmup | cooldown | run | recover): [@ ]` +**``** := `repeat: ( - )+` **``** := ` | | lap-button` diff --git a/src/main/scala/com.github.mgifos.workouts/GarminConnect.scala b/src/main/scala/com.github.mgifos.workouts/GarminConnect.scala index 9229dbc..c93ae74 100644 --- a/src/main/scala/com.github.mgifos.workouts/GarminConnect.scala +++ b/src/main/scala/com.github.mgifos.workouts/GarminConnect.scala @@ -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")