Private
Public Access
1
0

fit file download ok

This commit is contained in:
Sander Roosendaal
2021-02-24 19:49:03 +01:00
parent 197d6c9464
commit 8496178eee
6 changed files with 77 additions and 26 deletions

View File

@@ -81,7 +81,6 @@ from rowers.tasks import (
from rowers.utils import totaltime_sec_to_string
def step_to_string(step):
target_dict = {
'heart_rate': {
'name':'Heart Rate between',
@@ -136,24 +135,30 @@ def step_to_string(step):
t = dd['name']
l = ''
h = ''
if dd['low']:
v = step[dd['low']]
if value == 'heart_rate':
if v<100:
v = '{v} \%'.format(v=v)
else:
v = v-100
v = '{v}'.format(v=v)
l = '{v}'.format(v=v)
if dd['high']:
v = step[dd['high']]
if value == 'heart_rate':
if v<100:
v = '{v} \%'.format(v=v)
else:
v = v-100
v = '{v}'.format(v=v)
h = 'and {v}'.format(v=v)
try:
if dd['low']:
v = step[dd['low']]
if value == 'heart_rate':
if v<100:
v = '{v} \%'.format(v=v)
else:
v = v-100
v = '{v}'.format(v=v)
l = '{v}'.format(v=v)
except KeyError:
pass
try:
if dd['high']:
v = step[dd['high']]
if value == 'heart_rate':
if v<100:
v = '{v} \%'.format(v=v)
else:
v = v-100
v = '{v}'.format(v=v)
h = 'and {v}'.format(v=v)
except KeyError:
pass
target = '{t} {l} {h}'.format(
t = t,
@@ -1137,9 +1142,12 @@ def update_plannedsession(ps,cd):
if cd['fitfile']:
f = cd['fitfile']
filename, path_and_filename = handle_uploaded_file(f)
ps.fitfile.name = filename
try:
filename, path_and_filename = handle_uploaded_file(f)
ps.fitfile.name = filename
ps.steps_json = ''
except FileNotFoundError:
pass
ps.save()