From 32dac63f9c0c57617819079d99ad84a58cc6a069 Mon Sep 17 00:00:00 2001 From: kevforget <74352754+kevforget@users.noreply.github.com> Date: Mon, 2 Jan 2023 15:08:32 +0100 Subject: [PATCH] feat: Added check to verify if the session's total_distance is not explicitly null (#226) --- tapiriik/services/fit.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tapiriik/services/fit.py b/tapiriik/services/fit.py index 24815324..35c42ff5 100644 --- a/tapiriik/services/fit.py +++ b/tapiriik/services/fit.py @@ -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