diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py
index e50b9e93..e1ee9af7 100644
--- a/rowers/interactiveplots.py
+++ b/rowers/interactiveplots.py
@@ -1,3 +1,4 @@
+
from rowers.models import Workout, User, Rower, WorkoutForm,RowerForm,GraphImage
from rowingdata import rower as rrower
from rowingdata import main as rmain
diff --git a/rowers/templates/list_workouts.html b/rowers/templates/list_workouts.html
index d3cf848e..900564b4 100644
--- a/rowers/templates/list_workouts.html
+++ b/rowers/templates/list_workouts.html
@@ -26,77 +26,79 @@
My Workouts
{% if workouts %}
-
-
-
- | Date |
- Time |
- Name |
- Type |
- Distance |
- Duration |
- Avg HR |
- Max HR |
- Delete |
- Export |
-
-
-
- {% for workout in workouts %}
-
- | {{ workout.date }} |
- {{ workout.starttime }} |
-
- {% if user.rower.rowerplan == 'pro' %}
-{{ workout.name }} |
- {% else %}
-{{ workout.name }}
- {% endif %}
- {{ workout.workouttype }} |
- {{ workout.distance }}m |
- {{ workout.duration |durationprint:"%H:%M:%S.%f" }} |
- {{ workout.averagehr }} |
- {{ workout.maxhr }} |
- Delete |
- Export |
+
+
+
+ | Date |
+ Time |
+ Name |
+ Type |
+ Distance |
+ Duration |
+ Avg HR |
+ Max HR |
+ Delete |
+ Export |
+
+
+
+{% for workout in workouts %}
+
+ | {{ workout.date }} |
+ {{ workout.starttime }} |
+
+ {% if user.rower.rowerplan == 'pro' %}
+ {{ workout.name }} |
+ {% else %}
+ {{ workout.name }}
+{% endif %}
+ {{ workout.workouttype }} |
+ {{ workout.distance }}m |
+ {{ workout.duration |durationprint:"%H:%M:%S.%f" }} |
+ {{ workout.averagehr }} |
+ {{ workout.maxhr }} |
+ Delete |
+ Export |
+ Flex |
-
-
- {% endfor %}
-
-
- {% else %}
- No workouts found
- {% endif %}
+
+
+
+{% endfor %}
+
+
+{% else %}
+ No workouts found
+{% endif %}
{% if workouts.has_previous %}
<
{% endif %}
-
+
Page {{ workouts.number }} of {{ workouts.paginator.num_pages }}.
-
+
{% if workouts.has_next %}
>
{% endif %}
-
-
+
+
{% endblock %}
diff --git a/rowers/views.py b/rowers/views.py
index 2c8af572..72da81de 100644
--- a/rowers/views.py
+++ b/rowers/views.py
@@ -2688,10 +2688,20 @@ def workout_flexchart3_view(request,*args,**kwargs):
workstrokesonly = False
# create interactive plot
- script,div,js_resources,css_resources = interactive_flex_chart2(id,xparam=xparam,yparam1=yparam1,
+ try:
+ script,div,js_resources,css_resources = interactive_flex_chart2(id,xparam=xparam,yparam1=yparam1,
yparam2=yparam2,
promember=promember,plottype=plottype,
workstrokesonly=workstrokesonly)
+ except ValueError:
+ script,div = interactive_flex_chart2(id,xparam=xparam,yparam1=yparam1,
+ yparam2=yparam2,
+ promember=promember,plottype=plottype,
+ workstrokesonly=workstrokesonly)
+ js_resources = ""
+ css_resources = ""
+
+
# script = res[0]
# div = res[1]
# js_resources = res[2]
@@ -3634,10 +3644,10 @@ def workout_upload_view(request,message=""):
f1 = res[0] # file name
f2 = res[1] # file name incl media directory
-
+
# new
fileformat = get_file_type(f2)
-
+
if fileformat == 'unknown':
message = "We couldn't recognize the file type"
url = reverse(workout_upload_view,
@@ -3724,13 +3734,12 @@ def workout_upload_view(request,message=""):
if row == 0:
return HttpResponse("Error: CSV Data File Not Found")
- # auto smoothing
- pace = row.df[' Stroke500mPace (sec/500m)'].values
+ # auto smoothing
+ pace = row.df[' Stroke500mPace (sec/500m)'].values
velo = 500./pace
f = row.df['TimeStamp (sec)'].diff().mean()
windowsize = 2*(int(10./(f)))+1
-
if not 'originalvelo' in row.df:
row.df['originalvelo'] = velo
@@ -3742,9 +3751,9 @@ def workout_upload_view(request,message=""):
velo3 = pd.Series(velo2)
velo3 = velo3.replace([-np.inf,np.inf],np.nan)
velo3 = velo3.fillna(method='ffill')
-
- pace2 = 500./abs(velo3)
+ pace2 = 500./abs(velo3)
+
row.df[' Stroke500mPace (sec/500m)'] = pace2
row.df = row.df.fillna(0)
@@ -3754,7 +3763,6 @@ def workout_upload_view(request,message=""):
os.remove(f2)
except:
pass
-
# recalculate power data
if workouttype == 'rower' or workouttype == 'dynamic' or workouttype == 'slides':
@@ -3772,12 +3780,11 @@ def workout_upload_view(request,message=""):
averagehr = row.df[' HRCur (bpm)'].mean()
maxhr = row.df[' HRCur (bpm)'].max()
-
+
totaldist = row.df['cum_dist'].max()
totaltime = row.df['TimeStamp (sec)'].max()-row.df['TimeStamp (sec)'].min()
totaltime = totaltime+row.df.ix[0,' ElapsedTime (sec)']
-
hours = int(totaltime/3600.)
minutes = int((totaltime - 3600.*hours)/60.)
seconds = int(totaltime - 3600.*hours - 60.*minutes)
@@ -3798,7 +3805,6 @@ def workout_upload_view(request,message=""):
if (len(ws) != 0):
message = "Warning: This workout probably already exists in the database"
-
w = Workout(user=r,name=t,date=workoutdate,
workouttype=workouttype,
duration=duration,distance=totaldist,