Raistlfiren / garmin-csv-plan

A quick n' dirty way of "automating" training plans into Garmin Connect.
https://raistlfiren.github.io/garmin-csv-plan/
37 stars 6 forks source link

repeat in repeat support #8

Closed pygoubet closed 3 years ago

pygoubet commented 3 years ago

Hi,

It would be great to support repetition in a repetition. e.g.

running: 2x4x2'@z5
- warmup: 20:00
- repeat: 2
  - repeat: 4
    - run: 1:00 @z5
    - recover: 2:00 @z2
  - recover: 4:00
- cooldown: 10:00

Currently,

I have tried unsuccessfully to program the feature. I get lost in the recursion (repeat in repeat and so on) and json serialization. I will nevertheless propose a PR which ease the workout parsing by treating it as a Yaml string. Maybe you could consider it if you would like to add the feature.

pygoubet commented 3 years ago

The PR #10 provides an implementation of the feature.

pygoubet commented 3 years ago

Hello, I'd like to propose a new PR for the "inner repeat" feature to work back. Could you explain the bug you observed?

Raistlfiren commented 3 years ago

Sorry @pygoubet. I have been trying to work on unit/regression tests for the project to prevent this from happening while also implementing the feature to add workouts by name. The test I considered was:


running: 3.5-4h run
- run: 225:00
- cooldown: lap-button
pygoubet commented 3 years ago

The PR #13 provides a more robust implementation of subrepeaters feature. Invalid/non-parse-able lines are ignored, so that the import stops crashing.

Both imports are now successful.

Raistlfiren commented 3 years ago

Thanks @pygoubet. I hope to take a look at this either tomorrow or Sunday.