Private
Public Access
1
0

improving calculate trimp

This commit is contained in:
Sander Roosendaal
2023-05-31 09:29:43 +02:00
parent c8ba755b16
commit 615c059d32
3 changed files with 16 additions and 3 deletions

View File

@@ -1621,7 +1621,13 @@ def get_existing_job(w):
def workout_trimp(w, reset=False):
r = w.user
if w.trimp <= 0 and w.averagehr > 0:
if w.trimp is None:
if get_existing_job(w):
return 0, 0
elif w.averagehr is None:
if get_existing_job(w):
return w.trimp, 0
elif w.trimp <= 0 and w.averagehr > 0:
ftp = float(r.ftp)
_ = myqueue(
queuehigh,
@@ -1675,7 +1681,14 @@ def workout_trimp(w, reset=False):
r.max,
r.rest)
return 0, 0
trimp = 0
averagehr = 0
if w.trimp > 0:
trimp = w.trimp
if w.averagehr > 0:
averagehr = w.averagehr
return trimp, averagehr
def workout_rscore(w, reset=False):

Binary file not shown.

View File

@@ -372,7 +372,7 @@ def workout_import_view(request, source='c2'):
_ = integration.open()
except NoTokenError: # pragma: no cover
try:
url = importauthorizeviews[source]
url = reverse(importauthorizeviews[source],kwargs={'source':source})
return HttpResponseRedirect(url)
except KeyError:
messages.error(request,'Sorry, an error occurred. Please reauthorize')