From e0770a17e6c92602a14d2affd7be920c4946c3be Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Sun, 21 Mar 2021 13:37:29 +0100 Subject: [PATCH] s --- rowers/models.py | 25 ++++++++++++++----------- rowers/views/planviews.py | 4 +++- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/rowers/models.py b/rowers/models.py index bb9db4cb..a70a0071 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -2430,18 +2430,21 @@ class PlannedSession(models.Model): # interval string if self.interval_string: - 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']) + try: + 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 + except KeyError: + pass + self.steps = dct + except: + pass # sort units if self.sessionmode == 'distance': diff --git a/rowers/views/planviews.py b/rowers/views/planviews.py index 17325fb6..1e5d8898 100644 --- a/rowers/views/planviews.py +++ b/rowers/views/planviews.py @@ -2376,7 +2376,9 @@ def plannedsession_view(request,id=0,userid=0): 'sessionsport', 'sessiontype', 'sessionmode','criterium', - 'sessionvalue','sessionunit','comment', + 'sessionvalue','sessionunit', + 'approximate_distance','approximate_duration', + 'comment', ], 'workouts': ws, 'active':'nav-plan',