diff --git a/rowers/tests/testdata/testdata.tcx.gz b/rowers/tests/testdata/testdata.tcx.gz index d930dc83..d906cfbf 100644 Binary files a/rowers/tests/testdata/testdata.tcx.gz and b/rowers/tests/testdata/testdata.tcx.gz differ diff --git a/rowers/views/workoutviews.py b/rowers/views/workoutviews.py index cd956dec..73719594 100644 --- a/rowers/views/workoutviews.py +++ b/rowers/views/workoutviews.py @@ -2994,7 +2994,7 @@ def instroke_chart_interactive(request, id=0, analysis=0, userid=0): activeminutesmax = int(instroke_analysis.end_second/60.) spm_min = instroke_analysis.spm_min spm_max = instroke_analysis.spm_max - except (InStrokeAnalysis.DoesNotExist, ValueError): + except ValueError: metric = instrokemetrics[0] spm_min = 15 spm_max = 45 @@ -3002,11 +3002,22 @@ def instroke_chart_interactive(request, id=0, analysis=0, userid=0): notes = '' activeminutesmax = int(rowdata.duration/60.) activeminutesmin = 0 + except InStrokeAnalysis.DoesNotExist: + instroke_analysis = InStrokeAnalysis( + workout = w, + metric = instrokemetrics[0], + spm_min = 15, + spm_max = 45, + name = '', + notes = '', + activeminutesmax = int(rowdata.duration/60.), + activeminutesmin = 0 + ) + instroke_analysis.save() + analysis = instroke_analysis.id else: - metric = instrokemetrics[0] - spm_min = 15 spm_max = 45 name = '' @@ -3052,6 +3063,7 @@ def instroke_chart_interactive(request, id=0, analysis=0, userid=0): rower=w.user, ) else: + instroke_analysis = InStrokeAnalysis.objects.get(id=analysis) instroke_analysis.workout = w instroke_analysis.metric = metric instroke_analysis.name = name