msimms / OpenWorkoutTracker

A workout tracker for iOS that includes cycling, running, as well as strength exercises. Supports Bluetooth sensors.
Other
49 stars 3 forks source link

Gradient woes #51

Closed helmut72 closed 7 months ago

helmut72 commented 7 months ago

Describe the bug Gradient woes with big differences, up to over 100 degree.

To Reproduce Steps to reproduce the behavior:

  1. Add gradient metric field
  2. Start a workout
  3. Drive on
  4. See error

Expected behavior Gradient should be ok. In history view, also total ascent is over 500 meters, where it's nearly flat where I have tested.

Smartphone (please complete the following information):

Additional context Because it's rainy and need to drive to work, I have tested OpenWorkoutTracker in my car.

msimms commented 7 months ago

The gradient calculation hasn't really been tested and is probably just wrong. The area around me is extremely flat so I just need to develop a unit test based on a file that actually has some decent climbs in it. All that being said, my total ascent always seems right, just a few dozen meters on a typical ride.

msimms commented 7 months ago

Found and fixed a bug in the total ascent calculation. It was starting with the initial altitude, instead of zero. I would never have noticed because I live at sea level. Added a unit test to cover it.

helmut72 commented 7 months ago

Thanks. Will try it on weekend and hopefully on my bike, if weather is ok.