diff --git a/rowers/dataroutines.py b/rowers/dataroutines.py index 976342c0..3bcd683d 100644 --- a/rowers/dataroutines.py +++ b/rowers/dataroutines.py @@ -394,7 +394,7 @@ def df_resample(datadf): def clean_df_stats(datadf, workstrokesonly=True, ignorehr=True, - ignoreadvanced=False): + ignoreadvanced=False, for_chart=False): # clean data remove zeros and negative values try: @@ -643,7 +643,8 @@ def clean_df_stats(datadf, workstrokesonly=True, ignorehr=True, after = {} - return datadf + if for_chart: + return datadf for workoutid in data_orig['workoutid'].unique(): after[workoutid] = len( datadf[datadf['workoutid'] == workoutid].dropna()) @@ -1212,7 +1213,7 @@ def testdata(time, distance, pace, spm): # pragma: no cover def getrowdata_db(id=0, doclean=False, convertnewtons=True, - checkefficiency=True): + checkefficiency=True, for_chart=False): data = read_df_sql(id) try: data['deltat'] = data['time'].diff() @@ -1237,7 +1238,7 @@ def getrowdata_db(id=0, doclean=False, convertnewtons=True, data = add_efficiency(id=id) if doclean: # pragma: no cover - data = clean_df_stats(data, ignorehr=True) + data = clean_df_stats(data, ignorehr=True, for_chart=for_chart) return data, row @@ -1245,7 +1246,7 @@ def getrowdata_db(id=0, doclean=False, convertnewtons=True, def getsmallrowdata_db(columns, ids=[], doclean=True, workstrokesonly=True, compute=True, - debug=False): + debug=False, for_chart=False): # prepmultipledata(ids) if ids: @@ -1312,7 +1313,8 @@ def getsmallrowdata_db(columns, ids=[], doclean=True, workstrokesonly=True, comp data = df.copy() if doclean: data = clean_df_stats(data, ignorehr=True, - workstrokesonly=workstrokesonly) + workstrokesonly=workstrokesonly, + for_chart=for_chart) data.dropna(axis=1, how='all', inplace=True) data.dropna(axis=0, how='all', inplace=True) return data diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index e1745a17..df9a7bca 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -3987,10 +3987,10 @@ def interactive_cum_flex_chart2(theworkouts, promember=0, datadf = pd.DataFrame() if promember: datadf = dataprep.getsmallrowdata_db(columns, ids=ids, doclean=True, - workstrokesonly=workstrokesonly) + workstrokesonly=workstrokesonly, for_chart=True) else: - datadf = dataprep.getsmallrowdata_db(columns, ids=ids, doclean=True, - workstrokesonly=workstrokesonly) + datadf = dataprep.getsmallrowdata_db(columns_basic, ids=ids, doclean=True, + workstrokesonly=workstrokesonly, for_chart=True) try: _ = datadf[yparam2] @@ -5296,11 +5296,11 @@ def interactive_multiple_compare_chart(ids, xparam, yparam, plottype='line', if promember: datadf = dataprep.getsmallrowdata_db(columns, ids=ids, doclean=doclean, compute=compute, - workstrokesonly=workstrokesonly) + workstrokesonly=workstrokesonly, for_chart=True) else: - datadf = dataprep.getsmallrowdata_db(columns, ids=ids, doclean=doclean, + datadf = dataprep.getsmallrowdata_db(columns_basic, ids=ids, doclean=doclean, compute=compute, - workstrokesonly=workstrokesonly) + workstrokesonly=workstrokesonly, for_chart=True) datadf['workoutid'] = datadf['workoutid'].astype(int) datadf.dropna(axis=1, how='all', inplace=True) diff --git a/rowers/tests/testdata/testdata.tcx.gz b/rowers/tests/testdata/testdata.tcx.gz index 078ead98..c7d9b24a 100644 Binary files a/rowers/tests/testdata/testdata.tcx.gz and b/rowers/tests/testdata/testdata.tcx.gz differ