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:
percentOfFtp → FTP_PERCENTAGE
percentOfThresholdHr → LTHR_PERCENTAGE
percentOfThresholdPace → PACE_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
Description
Cycling workouts from TrainingPeaks that use
percentOfMaxHras 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
percentOfThresholdPaceconvert successfully with full step structure.Error from logs
Root cause
TPTargetMapper.ktonly maps three intensity types:percentOfFtp→FTP_PERCENTAGEpercentOfThresholdHr→LTHR_PERCENTAGEpercentOfThresholdPace→PACE_PERCENTAGEpercentOfMaxHr(percentage of max heart rate) is not in the map. WhengetByIntensity()encounters it, it throws anIllegalArgumentExceptionandTPToWorkoutConvertercatches it and skips the entire workout.Proposed fix
Add
MAX_HR_PERCENTAGEsupport across 3 files:1.
WorkoutStructure.kt— add enum value:2.
TPTargetMapper.kt— add mapping:3.
ToIntervalsStructureConverter.kt— add output format:Environment
percentOfMaxHrI have a working fix in a fork: https://github.com/andrebbruno/tp2intervals/tree/fix/add-percentOfMaxHr-support