Private
Public Access
1
0

using targetValueHigh and targetValueLow as recommended

This commit is contained in:
Sander Roosendaal
2021-05-17 17:54:56 +02:00
parent ce9621890a
commit f803878691

View File

@@ -267,32 +267,38 @@ def step_to_garmin(step,order=0):
targetValue = None targetValue = None
try: try:
targetValueLow = step['dict']['targetValueLow'] targetValueLow = step['dict']['targetValueLow']
if targetValueLow == 0: # pragma: no cover if targetValueLow == 0 and targetValue is not None and targetValue > 0:
targetValueLow = targetValue
targetValue = None
elif targetValueLow == 0: # pragma: no cover
targetValueLow = None targetValueLow = None
except KeyError: except KeyError:
targetValueLow = None targetValueLow = None
try: try:
targetValueHigh = step['dict']['targetValueHigh'] targetValueHigh = step['dict']['targetValueHigh']
if targetValueHigh == 0: # pragma: no cover if targetValue is not None and targetValue > 0 and targetValueHigh == 0:
targetValueHigh = targetValue
targetValue = 0
elif targetValueHigh == 0: # pragma: no cover
targetValueHigh = None targetValueHigh = None
except KeyError: except KeyError:
targetValueHigh = None targetValueHigh = None
if targetType is not None and targetType.lower() == "power": if targetType is not None and targetType.lower() == "power":
targetType = 'POWER' targetType = 'POWER'
if targetValue is not None and targetValue > 1000: #if targetValue is not None and targetValue > 1000:
targetValue -= 1000 # targetValue -= 1000
if targetValueHigh is not None and targetValueHigh > 1000: # pragma: no cover #if targetValueHigh is not None and targetValueHigh > 1000: # pragma: no cover
targetValueHigh -= 1000 # targetValueHigh -= 1000
if targetValueLow is not None and targetValueLow > 1000: # pragma: no cover #if targetValueLow is not None and targetValueLow > 1000: # pragma: no cover
targetValueLow -= 1000 # targetValueLow -= 1000
# temp - throw away target other than power # temp - throw away target other than power
if targetType is not None and targetType.lower() != 'power': #if targetType is not None and targetType.lower() != 'power':
targetType = None # targetType = None
targetValue = None # targetValue = None
targetValueLow = None # targetValueLow = None
targetValueHigh = None # targetValueHigh = None
if targetValue is None and targetValueLow is None and targetValueHigh is None: if targetValue is None and targetValueLow is None and targetValueHigh is None:
targetType = None targetType = None