Raistlfiren / garmin-csv-plan

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

Identical workouts in plan support #7

Closed pygoubet closed 3 years ago

pygoubet commented 3 years ago

This PR fixes workout deletion step in case of multiple workouts with the same name exist.

./bin/console garmin:workout tests/Resource/3-weeks-plan.csv import -n -x

"40'@z2-3" and "9x1'@5k r1'30" are created 2 times, OK no big deal but a new delete/import will fail

./bin/console garmin:workout tests/Resource/3-weeks-plan.csv import -n -x
...
[error] Error thrown while running command "garmin:workout 'tests/Resource/3-weeks-plan.csv' import -n -x". Message: "An unexpected response code was found: 404"

In GarminConnect.php line 320:

  An unexpected response code was found: 404

It crashes because it tries to delete the "40'@z2-3" workout 2 times.

# delete previous import
./bin/console garmin:workout tests/Resource/3-weeks-plan.csv import -n --delete-only
./bin/console garmin:workout tests/Resource/3-weeks-plan.csv schedule --start 2020-12-14 --no-interaction --delete

see in output "Workout - 40'@z2-3 was previously created on the Garmin website with the id" It will re-use existing workouts.

Raistlfiren commented 3 years ago

Thank you so much again!