tested split and flexchart
This commit is contained in:
@@ -433,6 +433,7 @@ def save_workout_database(f2,r,dosmooth=True,workouttype='rower',
|
||||
summary='',
|
||||
makeprivate=False,
|
||||
oarlength=2.89,inboard=0.88,
|
||||
forceunit='lbs',
|
||||
consistencychecks=False):
|
||||
message = None
|
||||
powerperc = 100*np.array([r.pw_ut2,
|
||||
@@ -447,7 +448,6 @@ def save_workout_database(f2,r,dosmooth=True,workouttype='rower',
|
||||
powerperc=powerperc,powerzones=r.powerzones)
|
||||
row = rdata(f2,rower=rr)
|
||||
|
||||
|
||||
dtavg = row.df['TimeStamp (sec)'].diff().mean()
|
||||
|
||||
if dtavg < 1:
|
||||
@@ -640,6 +640,7 @@ def save_workout_database(f2,r,dosmooth=True,workouttype='rower',
|
||||
weightcategory=r.weightcategory,
|
||||
starttime=workoutstarttime,
|
||||
workoutsource=workoutsource,
|
||||
forceunit=forceunit,
|
||||
csvfilename=f2,notes=notes,summary=summary,
|
||||
maxhr=maxhr,averagehr=averagehr,
|
||||
startdatetime=workoutstartdatetime,
|
||||
@@ -925,7 +926,8 @@ def split_workout(r,parent,splitsecond,splitmode):
|
||||
id,message = new_workout_from_df(r,data1,
|
||||
title=parent.name+' (1)',
|
||||
parent=parent,
|
||||
setprivate=setprivate)
|
||||
setprivate=setprivate,
|
||||
forceunit='N')
|
||||
messages.append(message)
|
||||
ids.append(id)
|
||||
if 'keep second' in splitmode:
|
||||
@@ -938,12 +940,12 @@ def split_workout(r,parent,splitsecond,splitmode):
|
||||
setprivate = False
|
||||
|
||||
dt = datetime.timedelta(seconds=splitsecond)
|
||||
|
||||
|
||||
id,message = new_workout_from_df(r,data2,
|
||||
title=parent.name+' (2)',
|
||||
parent=parent,
|
||||
setprivate=setprivate,
|
||||
dt=dt)
|
||||
dt=dt,forceunit='N')
|
||||
messages.append(message)
|
||||
ids.append(id)
|
||||
|
||||
@@ -968,6 +970,7 @@ def new_workout_from_df(r,df,
|
||||
title='New Workout',
|
||||
parent=None,
|
||||
setprivate=False,
|
||||
forceunit='lbs',
|
||||
dt=datetime.timedelta()):
|
||||
|
||||
message = None
|
||||
@@ -1001,7 +1004,10 @@ def new_workout_from_df(r,df,
|
||||
timestr = strftime("%Y%m%d-%H%M%S")
|
||||
|
||||
csvfilename ='media/df_'+timestr+'.csv'
|
||||
|
||||
if forceunit == 'N':
|
||||
# change to lbs for now
|
||||
df['peakforce'] /= lbstoN
|
||||
df['averageforce'] /= lbstoN
|
||||
|
||||
df.rename(columns = columndict,inplace=True)
|
||||
|
||||
@@ -1179,18 +1185,6 @@ def getsmallrowdata_db(columns,ids=[],doclean=True,workstrokesonly=True):
|
||||
|
||||
# convert newtons
|
||||
|
||||
if 'peakforce' in columns:
|
||||
funits = ((w.id,w.forceunit) for w in Workout.objects.filter(id__in=ids))
|
||||
for id,u in funits:
|
||||
if u=='lbs':
|
||||
mask = data['workoutid']==id
|
||||
data.loc[mask,'peakforce'] = data.loc[mask,'peakforce']*lbstoN
|
||||
if 'averageforce' in columns:
|
||||
funits = ((w.id,w.forceunit) for w in Workout.objects.filter(id__in=ids))
|
||||
for id,u in funits:
|
||||
if u=='lbs':
|
||||
mask = data['workoutid']==id
|
||||
data.loc[mask,'averageforce'] = data.loc[mask,'averageforce']*lbstoN
|
||||
|
||||
|
||||
if doclean:
|
||||
@@ -1298,7 +1292,7 @@ def read_cols_df_sql(ids,columns,convertnewtons=True):
|
||||
for id,u in funits:
|
||||
if u=='lbs':
|
||||
mask = df['workoutid']==id
|
||||
df.loc[mask,'peakforce'] = data.loc[mask,'peakforce']*lbstoN
|
||||
df.loc[mask,'peakforce'] = df.loc[mask,'peakforce']*lbstoN
|
||||
if 'averageforce' in columns:
|
||||
funits = ((w.id,w.forceunit) for w in Workout.objects.filter(id__in=ids))
|
||||
for id,u in funits:
|
||||
|
||||
Reference in New Issue
Block a user