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/tests/viewnames.csv b/rowers/tests/viewnames.csv index 41c2180d..02de6497 100644 --- a/rowers/tests/viewnames.csv +++ b/rowers/tests/viewnames.csv @@ -234,7 +234,7 @@ 236,326,plannedsessions_print_view,print view,TRUE,302,basic,200,403,basic,403,403,coach,200,403,FALSE,TRUE,FALSE,TRUE,TRUE, 237,327,plannedsession_comment_view,comment on planned session,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 238,330,plannedsessions_icsemail_view,send ICS email,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,TRUE,FALSE,FALSE,FALSE, -239,332,plannedsessions_view,View planned sessions,TRUE,302,basic,200,403,basic,403,403,coach,200,403,FALSE,TRUE,FALSE,TRUE,TRUE, +239,332,plannedsessions_view,View planned sessions,TRUE,302,basic,200,200,basic,200,200,coach,200,403,FALSE,TRUE,FALSE,FALSE,FALSE, 240,334,course_edit_view,Edit course,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 241,335,course_delete_view,Delete course,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, 242,336,course_kmldownload_view,Kmldownload course,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE, diff --git a/rowers/views/planviews.py b/rowers/views/planviews.py index 55216fc5..1e5d8898 100644 --- a/rowers/views/planviews.py +++ b/rowers/views/planviews.py @@ -1384,7 +1384,10 @@ from rowers.plannedsessions import cratiocolors,checkscores def plannedsessions_view(request, userid=0,startdatestring='',enddatestring=''): - r = getrequestplanrower(request,userid=userid) + try: + r = getrequestplanrower(request,userid=userid) + except PermissionDenied: + r = request.user.rower if startdatestring: try: @@ -2373,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',