Merge branch 'release/v11.93'
This commit is contained in:
@@ -483,6 +483,9 @@ def df_resample(datadf):
|
||||
def clean_df_stats(datadf, workstrokesonly=True, ignorehr=True,
|
||||
ignoreadvanced=False):
|
||||
# clean data remove zeros and negative values
|
||||
before = len(datadf)
|
||||
|
||||
data_orig = datadf.copy()
|
||||
|
||||
# bring metrics which have negative values to positive domain
|
||||
if len(datadf)==0:
|
||||
@@ -706,6 +709,12 @@ def clean_df_stats(datadf, workstrokesonly=True, ignorehr=True,
|
||||
except:
|
||||
pass
|
||||
|
||||
after = len(datadf.dropna())
|
||||
ratio = float(after)/float(before)
|
||||
|
||||
if ratio < 0.001 or after < 2:
|
||||
return data_orig
|
||||
|
||||
return datadf
|
||||
|
||||
def getstatsfields():
|
||||
@@ -1444,6 +1453,7 @@ def parsenonpainsled(fileformat,f2,summary):
|
||||
pass
|
||||
hasrecognized = True
|
||||
|
||||
|
||||
return row,hasrecognized,summary,fileformat
|
||||
|
||||
def handle_nonpainsled(f2, fileformat, summary=''):
|
||||
@@ -1465,6 +1475,7 @@ def handle_nonpainsled(f2, fileformat, summary=''):
|
||||
# should delete file
|
||||
f2 = f2[:-4] + 'o.csv'
|
||||
row2 = rrdata(df = row.df)
|
||||
|
||||
if 'speedcoach2' in fileformat:
|
||||
# impeller consistency
|
||||
impellerdata, consistent, ratio = row.impellerconsistent(threshold=0.3)
|
||||
@@ -1472,6 +1483,7 @@ def handle_nonpainsled(f2, fileformat, summary=''):
|
||||
impeller = True
|
||||
if impellerdata and not consistent:
|
||||
row2.use_gpsdata()
|
||||
|
||||
row2.write_csv(f2, gzip=True)
|
||||
|
||||
|
||||
|
||||
@@ -3715,6 +3715,7 @@ def interactive_flex_chart2(id=0,promember=0,
|
||||
rowdata = dataprep.getsmallrowdata_db(columns,ids=[id],doclean=True,
|
||||
workstrokesonly=workstrokesonly)
|
||||
|
||||
|
||||
if len(rowdata)<2:
|
||||
rowdata = dataprep.getsmallrowdata_db(columns,ids=[id],doclean=True,
|
||||
workstrokesonly=False)
|
||||
|
||||
@@ -85,7 +85,7 @@ class ForceUnits(TestCase):
|
||||
|
||||
df = dataprep.clean_df_stats(df,ignoreadvanced=False)
|
||||
average_N = int(df['averageforce'].mean())
|
||||
self.assertEqual(average_N,399)
|
||||
self.assertEqual(average_N,398)
|
||||
|
||||
def test_upload_speedcoach_N(self):
|
||||
login = self.c.login(username=self.u.username, password=self.password)
|
||||
|
||||
@@ -318,6 +318,7 @@ def trendflexdata(workouts, options,userid=0):
|
||||
datadf['date'].replace(datemapping,inplace=True)
|
||||
|
||||
today = datetime.date.today()
|
||||
|
||||
datadf['days ago'] = list(map(lambda x : x.days, datadf.date - today))
|
||||
|
||||
|
||||
@@ -648,6 +649,8 @@ def boxplotdata(workouts,options):
|
||||
|
||||
datadf['workoutid'].replace(datemapping,inplace=True)
|
||||
datadf.rename(columns={"workoutid":"date"},inplace=True)
|
||||
datadf['date'] = pd.to_datetime(datadf['date'],errors='coerce')
|
||||
datadf = datadf.dropna(subset=['date'])
|
||||
datadf = datadf.sort_values(['date'])
|
||||
|
||||
if userid == 0:
|
||||
|
||||
@@ -235,8 +235,6 @@ def workout_csvemail_view(request,id=0):
|
||||
|
||||
w = get_workout(id)
|
||||
|
||||
|
||||
|
||||
rowdata = rdata(w.csvfilename)
|
||||
code = str(uuid4())
|
||||
filename = code+'.csv'
|
||||
@@ -244,6 +242,7 @@ def workout_csvemail_view(request,id=0):
|
||||
rowdate = rowdata.rowdatetime
|
||||
starttimeunix = arrow.get(rowdate).timestamp
|
||||
df = rowdata.df
|
||||
|
||||
try:
|
||||
df[' ElapsedTime (sec)'] = df['TimeStamp (sec)']
|
||||
df['TimeStamp (sec)'] = df['TimeStamp (sec)'] + starttimeunix
|
||||
|
||||
Reference in New Issue
Block a user