diff --git a/rowers/urls.py b/rowers/urls.py
index cd51fe38..9c59e802 100644
--- a/rowers/urls.py
+++ b/rowers/urls.py
@@ -260,6 +260,8 @@ urlpatterns = [
views.instroke_chart_interactive, name='instroke_chart_interactive'),
re_path(r'^workout/(?P
\b[0-9A-Fa-f]+\b)/instroke/interactive/(?P\d+)/user/(?P\d+)/$',
views.instroke_chart_interactive, name='instroke_chart_interactive'),
+ re_path(r'^workout/(?P\b[0-9A-Fa-f]+\b)/instroke/interactive/(?P[A-Za-z_\ %20]+)/(?P[0-9]+\.?[0-9]*)/(?P[0-9]+\.?[0-9]*)/(?P[0-9]+\.?[0-9]*)/(?P[0-9]+\.?[0-9]*)/$',
+ views.instroke_data, name='instroke_data'),
re_path(r'^exportallworkouts/?/$', views.workouts_summaries_email_view,
name='workouts_summaries_email_view'),
path('failedjobs/', views.failed_queue_view, name='failed_queue_view'),
diff --git a/rowers/views/workoutviews.py b/rowers/views/workoutviews.py
index 076abcd4..c8ec5e45 100644
--- a/rowers/views/workoutviews.py
+++ b/rowers/views/workoutviews.py
@@ -3134,6 +3134,57 @@ def instroke_chart(request, id=0, metric=''): # pragma: no cover
return HttpResponseRedirect(url)
+@user_passes_test(ispromember, login_url="/rowers/paidplans",
+ message="This functionality requires a Pro plan or higher."
+ " If you are already a Pro user, please log in to access this functionality",
+ redirect_field_name=None)
+@permission_required('workout.change_workout', fn=get_workout_by_opaqueid, raise_exception=True)
+def instroke_data(request, metric='', spm_min=15, spm_max=45, activeminutesmin=0, activeminutesmax=0, id=0, ):
+ r = getrequestrower(request, userid=0)
+ w = get_workoutuser(id, request)
+ rowdata = rrdata(csvfile=w.csvfilename)
+ instrokemetrics = rowdata.get_instroke_columns()
+ if not metric:
+ metric = instrokemetrics[0]
+ if activeminutesmax == 0:
+ activeminutesmax = rowdata.duration/60.
+
+ try:
+ spm_min = float(spm_min)
+ except ValueError:
+ pass
+ try:
+ spm_max = float(spm_max)
+ except ValueError:
+ pass
+ try:
+ activeminutesmin = float(activeminutesmin)
+ except ValueError:
+ pass
+ try:
+ activeminutesmax = float(activeminutesmax)
+ except ValueError:
+ pass
+
+
+ data = rowdata.get_instroke_data(metric, spm_min=spm_min,
+ spm_max=spm_max,
+ activeminutesmin=activeminutesmin,
+ activeminutesmax=activeminutesmax,
+ )
+
+ filename = str(uuid4())+'.csv'
+
+ data.to_csv(filename)
+ with open(filename, 'r') as f:
+ response = HttpResponse(f)
+ response['Content-Disposition'] = 'attachment; filename="%s"' % filename
+ response['Content-Type'] = 'application/octet-stream'
+
+ os.remove(filename)
+ return response
+
+
@user_passes_test(ispromember, login_url="/rowers/paidplans",
message="This functionality requires a Pro plan or higher."
" If you are already a Pro user, please log in to access this functionality",
@@ -3398,6 +3449,7 @@ def instroke_chart_interactive(request, id=0, analysis=0, userid=0):
'teams': get_my_teams(request.user),
'instrokemetrics': instrokemetrics,
'form':form,
+ 'metric': metric,
'the_script': script,
'the_div': div,
'spm_min': spm_min,