Private
Public Access
1
0

some error checking for invalid y metrics

This commit is contained in:
Sander Roosendaal
2017-04-22 15:01:47 +02:00
parent 9769685253
commit 04a3595a0b
2 changed files with 33 additions and 0 deletions

View File

@@ -82,6 +82,7 @@ def interactive_forcecurve(theworkouts,workstrokesonly=False):
'workoutstate','driveenergy']
rowdata = dataprep.getsmallrowdata_db(columns,ids=ids)
rowdata.dropna(axis=1,how='all',inplace=True)
rowdata.dropna(axis=0,how='any',inplace=True)
@@ -369,6 +370,8 @@ def interactive_histoall(theworkouts):
ids = [int(w.id) for w in theworkouts]
rowdata = dataprep.getsmallrowdata_db(['power'],ids=ids,doclean=True)
rowdata.dropna(axis=0,how='any',inplace=True)
if rowdata.empty:
@@ -802,6 +805,7 @@ def interactive_chart(id=0,promember=0):
columns = ['time','pace','hr','fpace','ftime']
datadf = dataprep.getsmallrowdata_db(columns,ids=[id])
datadf.dropna(axis=0,how='any',inplace=True)
row = Workout.objects.get(id=id)
if datadf.empty:
@@ -883,6 +887,17 @@ def interactive_cum_flex_chart2(theworkouts,promember=0,
columns = [xparam,yparam1,yparam2,'spm','driveenergy','distance']
datadf = dataprep.getsmallrowdata_db(columns,ids=ids,doclean=False)
try:
tests = rowdata[yparam2]
except KeyError:
yparam2 = 'None'
try:
tests = rowdata[yparam1]
except KeyError:
yparam1 = 'None'
yparamname1 = axlabels[yparam1]
if yparam2 != 'None':
yparamname2 = axlabels[yparam2]
@@ -1167,6 +1182,16 @@ def interactive_flex_chart2(id=0,promember=0,
rowdata = dataprep.getsmallrowdata_db(columns,ids=[id],doclean=True,
workstrokesonly=workstrokesonly)
try:
tests = rowdata[yparam2]
except KeyError:
yparam2 = 'None'
try:
tests = rowdata[yparam1]
except KeyError:
yparam1 = 'None'
rowdata.dropna(axis=1,how='all',inplace=True)
rowdata.dropna(axis=0,how='any',inplace=True)