fixing step editor
This commit is contained in:
@@ -740,6 +740,10 @@ def steps_write_fit(steps):
|
|||||||
# convert to json, value of keys called wkt_step_name to string
|
# convert to json, value of keys called wkt_step_name to string
|
||||||
for step in steps['steps']:
|
for step in steps['steps']:
|
||||||
step['wkt_step_name'] = str(step['wkt_step_name'])
|
step['wkt_step_name'] = str(step['wkt_step_name'])
|
||||||
|
# convert numerical values in the dict to integers
|
||||||
|
for key in step.keys():
|
||||||
|
if isinstance(step[key], (int, float)):
|
||||||
|
step[key] = int(step[key])
|
||||||
|
|
||||||
response = requests.post(url=url, headers=headers, json=steps)
|
response = requests.post(url=url, headers=headers, json=steps)
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ def download_fit(request, filename=''):
|
|||||||
try:
|
try:
|
||||||
response = HttpResponse(fitfile)
|
response = HttpResponse(fitfile)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
|
print(fitfile, "not found")
|
||||||
raise Http404("File not found")
|
raise Http404("File not found")
|
||||||
|
|
||||||
response['Content-Disposition'] = 'attachment; filename="%s"' % filename # pragma: no cover
|
response['Content-Disposition'] = 'attachment; filename="%s"' % filename # pragma: no cover
|
||||||
|
|||||||
@@ -3204,7 +3204,7 @@ def stepedit(request, id=0, psid=0):
|
|||||||
if form.cleaned_data['durationtype'] == 'Time':
|
if form.cleaned_data['durationtype'] == 'Time':
|
||||||
ss['durationValue'] = form.cleaned_data['durationvalue']*60000
|
ss['durationValue'] = form.cleaned_data['durationvalue']*60000
|
||||||
elif form.cleaned_data['durationtype'] == 'Distance':
|
elif form.cleaned_data['durationtype'] == 'Distance':
|
||||||
ss[durationValue] = form.cleaned_data['durationvalue']*100
|
ss['durationValue'] = form.cleaned_data['durationvalue']*100
|
||||||
|
|
||||||
ss['durationValue'] = int(ss['durationValue'])
|
ss['durationValue'] = int(ss['durationValue'])
|
||||||
ps.fitfile = None
|
ps.fitfile = None
|
||||||
|
|||||||
Reference in New Issue
Block a user