diff --git a/rowers/dataprep.py b/rowers/dataprep.py index e9658fbc..df2f033c 100644 --- a/rowers/dataprep.py +++ b/rowers/dataprep.py @@ -408,7 +408,7 @@ def filter_df(datadf, fieldname, value, largerthan=True): def join_workouts(r,ids,title='Joined Workout', parent=None, setprivate=False, - forceunit='lbs'): + forceunit='lbs',killparents=False): message = None @@ -477,6 +477,10 @@ def join_workouts(r,ids,title='Joined Workout', dosmooth=False, consistencychecks=False) + if killparents: + for w in ws: + w.delete() + return (id, message) diff --git a/rowers/forms.py b/rowers/forms.py index 46443563..98971e53 100644 --- a/rowers/forms.py +++ b/rowers/forms.py @@ -1091,6 +1091,8 @@ metricchoices = list(sorted(formaxlabels.items(), key = lambda x:x[1])) class WorkoutJoinParamForm(forms.Form): workout_name = forms.CharField(required = True, initial = 'Joined Workout') set_private = forms.BooleanField(initial=False, required = False) + killparents = forms.BooleanField(initial=False, required = False, + label='Delete original workouts') class FusionMetricChoiceForm(ModelForm): class Meta: diff --git a/rowers/templates/workout_join_select.html b/rowers/templates/workout_join_select.html index ab1035b1..73ccca7c 100644 --- a/rowers/templates/workout_join_select.html +++ b/rowers/templates/workout_join_select.html @@ -17,21 +17,21 @@ +