diff --git a/rowers/dataprep.py b/rowers/dataprep.py index 3e86d293..4cd30c5e 100644 --- a/rowers/dataprep.py +++ b/rowers/dataprep.py @@ -2175,7 +2175,7 @@ def dataprep(rowdatadf, id=0, bands=True, barchart=True, otwpower=True, drivespeed = drivespeed.fillna(value=0) try: - print('driveenergy',rowdatadf['driveenergy'].mean()) + driveenergy = rowdatadf['driveenergy'] except KeyError: if forceunit == 'lbs': driveenergy = drivelength * averageforce * lbstoN diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index 64a18653..a75bee66 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -1214,7 +1214,9 @@ def fitnessmetric_chart(fitnessmetrics,user,workoutmode='rower',startdate=None, return [script,div] -def interactive_histoall(theworkouts,histoparam,includereststrokes): +def interactive_histoall(theworkouts,histoparam,includereststrokes, + spmmin=0,spmmax=55, + workmin=0,workmax=1500): TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair' ids = [int(w.id) for w in theworkouts] @@ -1224,6 +1226,12 @@ def interactive_histoall(theworkouts,histoparam,includereststrokes): rowdata.dropna(axis=0,how='any',inplace=True) + rowdata = dataprep.filter_df(rowdata,'spm',spmmin,largerthan=True) + rowdata = dataprep.filter_df(rowdata,'spm',spmmax,largerthan=False) + + rowdata = dataprep.filter_df(rowdata,'driveenergy',workmin,largerthan=True) + rowdata = dataprep.filter_df(rowdata,'driveenergy',workmax,largerthan=False) + if rowdata.empty: return "","No Valid Data Available" diff --git a/rowers/tests/testdata/testdata.csv.gz b/rowers/tests/testdata/testdata.csv.gz index 49e8b984..93a865ec 100644 Binary files a/rowers/tests/testdata/testdata.csv.gz and b/rowers/tests/testdata/testdata.csv.gz differ diff --git a/rowers/views/analysisviews.py b/rowers/views/analysisviews.py index f5cd3a77..6a753d5d 100644 --- a/rowers/views/analysisviews.py +++ b/rowers/views/analysisviews.py @@ -58,6 +58,7 @@ def analysis_new(request,userid=0,function='boxplot'): waterboattype = mytypes.waterboattype if request.method == 'POST': + thediv = get_call() dateform = DateRangeForm(request.POST) if dateform.is_valid(): startdate = dateform.cleaned_data['startdate'] @@ -105,6 +106,7 @@ def analysis_new(request,userid=0,function='boxplot'): ids = [] options['ids'] = ids else: + thediv = '' dateform = DateRangeForm(initial={ 'startdate':startdate, 'enddate':enddate, @@ -209,6 +211,7 @@ def analysis_new(request,userid=0,function='boxplot'): 'rower':r, 'breadcrumbs':breadcrumbs, 'theuser':user, + 'the_div':thediv, 'form':form, 'active':'nav-analysis', 'chartform':chartform, @@ -416,10 +419,16 @@ def histodata(workouts, options): includereststrokes = options['includereststrokes'] plotfield = options['plotfield'] function = options['function'] + spmmin = options['spmmin'] + spmmax = options['spmmax'] + workmin = options['workmin'] + workmax = options['workmax'] + workstrokesonly = not includereststrokes - script, div = interactive_histoall(workouts,plotfield,includereststrokes) + script, div = interactive_histoall(workouts,plotfield,includereststrokes, + spmmin=spmmin,spmmax=spmmax,workmin=workmin,workmax=workmax) scripta = script.split('\n')[2:-1] @@ -2954,6 +2963,8 @@ def multiflex_data(request,userid=0, 'ploterrorbars':False, }): + def_options = options + if 'options' in request.session: options = request.session['options'] @@ -2978,16 +2989,16 @@ def multiflex_data(request,userid=0, userid = request.user.id - palette = options['palette'] - groupby = options['groupby'] - binsize = options['binsize'] - xparam = options['xparam'] - yparam = options['yparam'] - spmmin = options['spmmin'] - spmmax = options['spmmax'] - workmin = options['workmin'] - workmax = options['workmax'] - ids = options['ids'] + palette = keyvalue_get_default('palette',options, def_options) + groupby = keyvalue_get_default('groupby',options, def_options) + binsize = keyvalue_get_default('binsize',options, def_options) + xparam = keyvalue_get_default('xparam',options, def_options) + yparam = keyvalue_get_default('yparam',options, def_options) + spmmin = keyvalue_get_default('spmmin',options, def_options) + spmmax = keyvalue_get_default('spmmax',options, def_options) + workmin = keyvalue_get_default('workmin',options, def_options) + workmax = keyvalue_get_default('workmax',options, def_options) + ids = keyvalue_get_default('ids',options, def_options) workouts = []