Skip to content

Cycling workouts with percentOfMaxHr intensity are skipped during conversion #115

@andrebbruno

Description

@andrebbruno

Description

Cycling workouts from TrainingPeaks that use percentOfMaxHr as the intensity type fail to convert and are skipped entirely. The workout structure (steps) arrives empty in Intervals.icu, while the workout name and description are imported correctly.

Running workouts using percentOfThresholdPace convert successfully with full step structure.

Error from logs

WARN o.f.t.i.p.t.w.TPToWorkoutConverter: Error during TP Workout conversion, skipping, 
  id: 3607857857, name: Bike Ritmo e Vo2 Max., error - Cant convert intensity percentOfMaxHr

Root cause

TPTargetMapper.kt only maps three intensity types:

  • percentOfFtpFTP_PERCENTAGE
  • percentOfThresholdHrLTHR_PERCENTAGE
  • percentOfThresholdPacePACE_PERCENTAGE

percentOfMaxHr (percentage of max heart rate) is not in the map. When getByIntensity() encounters it, it throws an IllegalArgumentException and TPToWorkoutConverter catches it and skips the entire workout.

Proposed fix

Add MAX_HR_PERCENTAGE support across 3 files:

1. WorkoutStructure.kt — add enum value:

enum class TargetUnit {
    FTP_PERCENTAGE,
    LTHR_PERCENTAGE,
    PACE_PERCENTAGE,
    MAX_HR_PERCENTAGE,
}

2. TPTargetMapper.kt — add mapping:

WorkoutStructure.TargetUnit.MAX_HR_PERCENTAGE to "percentOfMaxHr",

3. ToIntervalsStructureConverter.kt — add output format:

WorkoutStructure.TargetUnit.MAX_HR_PERCENTAGE to "% HRmax",

Environment

  • tp2intervals version: 0.12.3
  • TrainingPeaks workout type: Cycling (Ride)
  • Intensity type in TP: percentOfMaxHr

I have a working fix in a fork: https://github.com/andrebbruno/tp2intervals/tree/fix/add-percentOfMaxHr-support

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions