Closed thepiper18 closed 2 years ago
With the latest update to TrainasOne they added the option to download the workout in JSON format. Using the JSON instead of parsing the website should be more reliable. Speeds are given in m/s and all the steps seem to be properly named.
For reference, this is a simple economy workout:
{
"workoutName": "Some Workout",
"sport": "RUNNING",
"workoutProvider": "TrainAsONE",
"workoutSourceId": "TrainAsONE",
"steps": [
{
"type": "WorkoutStep",
"stepOrder": 1,
"intensity": "WARMUP",
"durationType": "TIME",
"durationValue": 300.0,
"targetType": "SPEED",
"targetValue": 3,
"targetValueLow": 2.5,
"targetValueHigh": 3.5
},
{
"type": "WorkoutStep",
"stepOrder": 2,
"intensity": "ACTIVE",
"durationType": "TIME",
"durationValue": 1380.0,
"targetType": "SPEED",
"targetValue": 4,
"targetValueLow": 3.8,
"targetValueHigh": 4.2
}
]
}
@gazpachoking Are you interested in a pull request for this?
@jahofmann Oh that's awesome, converting to this would be great. I'd love a pull request for that!
@thepiper18 Does the race also come with a workout file attached? If so, could you provide me the JSON?
workout-548S-trail-race-casual.txt @jahofmann Yes, it does. I'll copy it below and also try to attach the file, please let me know if it doesn't work (knock on wood):
{"workoutName":"W548S Lekfara country run 13km 17.4℃ 2.24U","description":"","sport":"RUNNING","workoutProvider":"TrainAsONE","workoutSourceId":"TrainAsONE","steps":[{"type":"WorkoutStep","stepOrder":1,"intensity":"ACTIVE","durationType":"TIME","durationValue":4130.0,"targetType":"SPEED","targetValue":3.148751894456083,"targetValueLow":3.0542893376224,"targetValueHigh":3.243214451289765},{"type":"WorkoutStep","stepOrder":2,"intensity":"COOLDOWN","description":"Run back","durationType":"OPEN","targetType":"OPEN"}]}
Many thanks!!
Oh, it looks like it's the 'run back' step that's causing issues.
I had the feeling it could be, yeah. However, I tried turning off the run back option in TAO, but I still get the same issue, although the new workout available in TAO does not shows it anymore. Weird...
Run back step shouldn't be hard to handle, I'm going to wait until we switch over to the new JSON method though, as everything should be cleaner and easier to maintain when we don't have to scrape anymore.
Ok, so a quick update after my race. As my legs are sore, I decided to rest in from of the computer and re-ran the Linux trainaspower version (the classic, not the JSON recent commit).
The next two workouts were imported correctly. The third workout is, again, a race, and I received an error message.
The log is as follows:
2021-10-31 13:25:10.563 | INFO | trainaspower.trainasone:get_next_workouts:40 - Fetching next TrainAsOne workout.
2021-10-31 13:25:13.579 | INFO | trainaspower.trainasone:get_workout:93 - Converting TrainAsOne workout to power.
2021-10-31 13:25:19.040 | INFO | trainaspower.finalsurge:add_workout:140 - Posting workout `552V 6 min Assessment run` to Final Surge
2021-10-31 13:25:21.162 | INFO | trainaspower.trainasone:get_workout:93 - Converting TrainAsOne workout to power.
2021-10-31 13:25:24.491 | INFO | trainaspower.finalsurge:add_workout:140 - Posting workout `553U Economy run` to Final Surge
2021-10-31 13:25:27.017 | INFO | trainaspower.trainasone:get_workout:93 - Converting TrainAsOne workout to power.
2021-10-31 13:25:28.088 | ERROR | trainaspower.main:main:100 - Could not load next Train as One workout. Created taocalendar.html for debugging.
Is this still an issue with the new JSON handling?
I just ran into this "Could not load next Train as One workout" issue right after changing from TAO free to the paid plan. That was the only change I made. It worked well under the free plan. This is the error:
trainaspower.trainasone.FindWorkoutException: Error finding next TaO workout: Error finding workout steps: ("'NoneType' object has no attribute 'group'",)
This is my next run:
Reverting to v0.6.5 fixed the issue. I don't have "run back" enabled. Update: I disabled "Adjust pace for temperature" and that fixed the issue for v0.7.3. With adjust pace for temperature active, the JSON file has the "℉" symbol. Could that be causing an error? Image: adjust pace for temperature inactive on left, active on right.
Reverting to v0.6.5 fixed the issue. I don't have "run back" enabled. Update: I disabled "Adjust pace for temperature" and that fixed the issue for v0.7.3. With adjust pace for temperature active, the JSON file has the "℉" symbol. Could that be causing an error? Image: adjust pace for temperature inactive on left, active on right.
Thanks @jamorris. Should be fixed now in the latest version.
As discussed on Reddit. I now installed it on Linux, and the same error happens, possibly because my next workout is a race (?). In my TAO settings, I already turned off the "run back" setting too, although TrainAsPower seems to still be looking for it... (?)
Log file (personal data deleted for privacy reasons):
Thanks a lot for your feedback & advice, congrats once again for making this great tool possible! :-)