sivertschou / dundring

dundring.com is a free and open source in-browser training application created to control and track your training with a smart bike trainer⚡️
https://dundring.com
Apache License 2.0
62 stars 8 forks source link

Add .zwo-upload #408

Open morteako opened 1 month ago

morteako commented 1 month ago

Adds the possiblity to upload .zwo-files that are parsed into dundring.com-workouts.

image

Design is ofc up for discussion and fixes pushed directly to the branch are welcomed

There are a lot of events in zwo that we can't currently support, but for f.ex. trainingpeaks exports, this will cover the events in normal workouts.

Errors

Regarding errors, I have taken a try-to-do-something-when-encoutering-bad-data approach, since this is kind of a beta feature. Therefore this will only fail hard if it doesnt find necessary data (the workout element and such), but for missing attributes such as power, duration or unparsable numbers, it will default to 0, but it will give a warning in form of a toast.

Partially solves #398 and MVP-version of #185

Default test .zwo-file

<workout_file>
    <author>Edvard Viggaklev Bakken (via TrainingPeaks)</author>
    <name>JOIN Cycling - 5x 4 min VO2max</name>
    <description>5x 4 minute VO2max intervals. Go all out, but try to perform evenly across all intervals.</description>
    <sportType>bike</sportType>
    <tags/>
    <workout>
        <SteadyState Duration="2400" Power="0.65" Cadence="90">
        </SteadyState>
        <IntervalsT Repeat="5" OnDuration="240" OnPower="1.08" OffDuration="300" OffPower="0.55" Cadence="100" CadenceResting="85" >
        </IntervalsT>
        <SteadyState Duration="2100" Power="0.65" Cadence="90">
        </SteadyState>
    </workout>
</workout_file>

(Funny Mac/Chrome/Spectacle-bug in action in the gifs when the file-upload moves the window 🙃 )

Correct file => parsed with no warning

2024-10-13 17 48 32

Missing workout => no parse with Error

2024-10-13 17 48 49

Missing duration => workout parsed, but with warning and missing duration to 0

2024-10-13 17 49 07

morteako commented 1 week ago

Should be ready now :))