From 7190d97d29d4d0463cfa7c58ca0c22675bc9ed89 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Wed, 22 Jan 2025 20:50:02 +0100 Subject: [PATCH] fixing step editor --- rowers/utils.py | 4 ++++ rowers/views/otherviews.py | 1 + rowers/views/planviews.py | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/rowers/utils.py b/rowers/utils.py index 0072805b..070f1a45 100644 --- a/rowers/utils.py +++ b/rowers/utils.py @@ -740,6 +740,10 @@ def steps_write_fit(steps): # convert to json, value of keys called wkt_step_name to string for step in steps['steps']: 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) diff --git a/rowers/views/otherviews.py b/rowers/views/otherviews.py index 3fef3dd5..bd59a9bf 100644 --- a/rowers/views/otherviews.py +++ b/rowers/views/otherviews.py @@ -50,6 +50,7 @@ def download_fit(request, filename=''): try: response = HttpResponse(fitfile) except FileNotFoundError: + print(fitfile, "not found") raise Http404("File not found") response['Content-Disposition'] = 'attachment; filename="%s"' % filename # pragma: no cover diff --git a/rowers/views/planviews.py b/rowers/views/planviews.py index 8ba2c0ba..5833c5a5 100644 --- a/rowers/views/planviews.py +++ b/rowers/views/planviews.py @@ -3204,7 +3204,7 @@ def stepedit(request, id=0, psid=0): if form.cleaned_data['durationtype'] == 'Time': ss['durationValue'] = form.cleaned_data['durationvalue']*60000 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']) ps.fitfile = None