Private
Public Access
1
0

fix trendflex

This commit is contained in:
Sander Roosendaal
2022-09-14 16:53:15 +02:00
parent b0b3631a9c
commit 44af254aa2
3 changed files with 67 additions and 2 deletions

View File

@@ -132,6 +132,8 @@
palette.show(); palette.show();
binsize.show(); binsize.show();
errorbars.show(); errorbars.show();
workmin.show();
workmax.show();
}; };
if (functionfield.val() == 'flexall') { if (functionfield.val() == 'flexall') {
@@ -392,7 +394,7 @@
and weight category ({{ weightcategory }}). The Gold Medal and weight category ({{ weightcategory }}). The Gold Medal
Standard power is derived from the Standard power is derived from the
<a href="http://www.concept2.com/indoor-rowers/racing/records/world"> <a href="http://www.concept2.com/indoor-rowers/racing/records/world">
World Record</a> for your category. World Record</a> for your category.
The percentile lines are estimates of where the percentiles The percentile lines are estimates of where the percentiles
of the Concept2 rankings historically are for those of exactly of the Concept2 rankings historically are for those of exactly
your age, gender and weight class. your age, gender and weight class.

View File

@@ -830,6 +830,69 @@ class WorkoutStatsTestNew(TestCase):
script, div = statsdata(workouts,options) script, div = statsdata(workouts,options)
script, div = comparisondata(workouts,options) script, div = comparisondata(workouts,options)
@patch('rowers.dataprep.create_engine')
@patch('rowers.dataprep.getsmallrowdata_db', side_effect=mocked_getsmallrowdata_db)
@patch('rowers.dataprep.read_cols_df_sql', side_effect=mocked_read_cols_df_sql)
def test_analysis_data2(self,
mocked_sqlalchemy,
mocked_getsmallrowdata_db,
mocked_read_cols_df_sql,
):
startdate = (self.user_workouts[0].startdatetime-datetime.timedelta(days=3)).date()
enddate = (self.user_workouts[0].startdatetime+datetime.timedelta(days=3)).date()
# make sure the dates are not naive
try:
startdate = pytz.utc.localize(startdate)
except (ValueError, AttributeError):
pass
try:
enddate = pytz.utc.localize(enddate)
except (ValueError, AttributeError):
pass
options = {
'function':'flexall',
'xparam':'spm',
'plotfield':'spm',
'yparam':'power',
'groupby':'spm',
'binsize':1,
'ploterrorbars':True,
'palette':'monochrome_blue',
'xaxis':'time',
'yaxis1':'power',
'yaxis2':'hr',
'startdate':startdate,
'enddate':enddate,
'plottype':'scatter',
'spmmin':15,
'spmmax':55,
'workmin':0,
'workmax':1500,
'cpfit':'data',
'piece': 4,
'cpoverlay':True,
'cpfit':'data',
'includereststrokes':False,
'modality':'all',
'waterboattype':['1x','2x','4x'],
'ids':[1,2,3],
'userid':self.u.id,
}
workouts = self.user_workouts
script, div = boxplotdata(workouts,options)
script, div = trendflexdata(workouts,options)
script, div = histodata(workouts,options)
script, div = cpdata(workouts,options)
script, div = flexalldata(workouts,options)
script, div = statsdata(workouts,options)
script, div = comparisondata(workouts,options)
@patch('rowers.dataprep.create_engine') @patch('rowers.dataprep.create_engine')
@patch('rowers.dataprep.getsmallrowdata_db', side_effect=mocked_getsmallrowdata_db) @patch('rowers.dataprep.getsmallrowdata_db', side_effect=mocked_getsmallrowdata_db)
@patch('rowers.dataprep.read_cols_df_sql', side_effect=mocked_read_cols_df_sql) @patch('rowers.dataprep.read_cols_df_sql', side_effect=mocked_read_cols_df_sql)

View File

@@ -317,7 +317,7 @@ def trendflexdata(workouts, options, userid=0):
if xparam == groupby: # pragma: no cover if xparam == groupby: # pragma: no cover
datadf['groupby'] = datadf[xparam] datadf['groupby'] = datadf[xparam]
groupby = 'groupby' #groupby = 'groupby'
datadf = dataprep.clean_df_stats(datadf, workstrokesonly=workstrokesonly) datadf = dataprep.clean_df_stats(datadf, workstrokesonly=workstrokesonly)