jovandeginste / workout-tracker

A workout tracking web application for personal use (or family, friends), geared towards running and other GPX-based activities
Other
958 stars 30 forks source link

Fix the initial minimum elevation #28

Closed jovandeginste closed 8 months ago

jovandeginste commented 8 months ago

If we start at 0m elevation, the chance is real this will always be lower than any actual elevation. We now initialize it at 100km, which ... should realistically be higher than any real minimal elevation.

Finally, we will make sure it is not higher than the maxElevation.

jovandeginste commented 8 months ago

ping @pixelspark - I didn't think about this, all my minElevations were weird suddenly :smile:

pixelspark commented 8 months ago

Eh, right, should've caught that 🤣 (some background - I am fairly new to Go, but experienced in Rust where this can't happen because you need to either initialize new variables with a value or use an option type)

jovandeginste commented 8 months ago

Eh, right, should've caught that 🤣 (some background - I am fairly new to Go, but experienced in Rust where this can't happen because you need to either initialize new variables with a value or use an option type)

This would be exactly the same, since you initialized it to 0.0 in your first version... Go just assumes you want the zero-value if you don't specify an explicit value...

pixelspark commented 8 months ago

Eh, right, should've caught that 🤣 (some background - I am fairly new to Go, but experienced in Rust where this can't happen because you need to either initialize new variables with a value or use an option type)

This would be exactly the same, since you initialized it to 0.0 in your first version... Go just assumes you want the zero-value if you don't specify an explicit value...

Yeah no type system will fix sleepy programmers :-)