Raistlfiren/garmin-csv-plan

repeat in repeat support

Closed this issue · 5 comments

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.

The PR #10 provides an implementation of the feature.

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

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

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

  • Example with some syntax errors:
"WEEK","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"
"1","running: 3.5-4h run
- run 225:00
- cooldown: lap-button","running: 2x4x2'@z5
- warmup: 20:00
- repeat: 2
  - repeat: 4
    - run 1:00 @z5
    - recover: 2:00 @z2
  - recover: 4:00
- cooldown: 10:00","","","","",""
  • Without syntax errors:
"WEEK","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"
"1","running: 3.5-4h run
- run: 225:00
- cooldown: lap-button","running: 2x4x2'@z5
- warmup: 20:00
- repeat: 2
  - repeat: 4
    - run: 1:00 @z5
    - recover: 2:00 @z2
  - recover: 4:00
- cooldown: 10:00","","","","",""

Both imports are now successful.

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