Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Commit

Permalink
feat: Added check to verify if the session's total_distance is not ex…
Browse files Browse the repository at this point in the history
…plicitly null (#226)
  • Loading branch information
kevforget authored Jan 2, 2023
1 parent 463d692 commit 32dac63
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tapiriik/services/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,9 @@ def Parse(fitData, activity=None):
avg_speed_to_use = None
max_speed_to_use = None

if actividata.get("total_distance", 0) != 0 and moving_time_to_use != 0:
total_distance = actividata.get("total_distance", 0)

if total_distance != 0 and total_distance is not None and moving_time_to_use != 0:
# The *3.6 is the m/s to Km/h conversion.
# Also implemented the usage of "enhanced values" because Garmin prefer using them.
# Also made an last resort fallback to recalculate the speed if all values are None
Expand Down

0 comments on commit 32dac63

Please sign in to comment.