Skip to content

Commit

Permalink
Merge pull request #23 from jahofmann/master
Browse files Browse the repository at this point in the history
Provide error message if speed is not target
  • Loading branch information
gazpachoking authored Jan 21, 2022
2 parents e78c586 + 0bffc52 commit e048422
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions trainaspower/trainasone.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def get_workout(workout_url: str, date: datetime.date, config: models.Config) ->
def convert_steps(steps, config: models.Config, perceived_effort: bool) -> Generator[models.Step, None, None]:
recovery_step_types = ["REST", "RECOVERY", "COOLDOWN"]
active_step_types = ["ACTIVE", "INTERVAL"]
valid_target_types = ["OPEN", "SPEED"]
for step in steps:
if step["type"] == "WorkoutRepeatStep":
times = int(step["repeatValue"])
Expand All @@ -125,6 +126,10 @@ def convert_steps(steps, config: models.Config, perceived_effort: bool) -> Gener
if "description" in step:
out_step.description = step["description"]

if not step["targetType"] in valid_target_types:
raise ValueError(
f"Unsupported target type {step['targetType']}. Please ensure that you have selected speed as \"Workout step target\" in the TAO settings under \"Garmin workout preferences\"")

if step["intensity"] == "WARMUP":
out_step.type = "WARMUP"
elif step["intensity"] in active_step_types:
Expand Down

0 comments on commit e048422

Please sign in to comment.