From 7e09d080740ba0ca105cf45cfdc2b9d6a08fd955 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Fri, 5 Mar 2021 15:42:58 +0100 Subject: [PATCH] fixing steps dictionary --- rowers/models.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/rowers/models.py b/rowers/models.py index c6eaf2ec..324a7927 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -2367,6 +2367,14 @@ class PlannedSession(models.Model): dct = trainingparser.parsetodict(self.interval_string) dct = [item for item in dct if item['value'] != 0] dct = trainingparser.tofitdict(dct) + for step in dct['steps']: + try: + step['targetValue'] = int(step['targetValue']) + step['targetValueLow'] = int(step['targetValueHigh']) + step['targetValueHigh'] = int(step['targetValueLow']) + + except KeyError: + pass self.steps = dct # sort units @@ -2413,12 +2421,13 @@ class PlannedSession(models.Model): if self.steps and not self.fitfile: filename = 'aap.fit' filename = get_file_path(self,filename) + steps = self.steps steps['filename'] = os.path.join(settings.MEDIA_ROOT,filename) fitfile = steps_write_fit(steps) self.fitfile.name = filename self.steps = steps - print(self.fitfile.name,filename) + # calculate approximate distance if self.steps: