manually adding ranking pieces works
This commit is contained in:
@@ -556,16 +556,15 @@ def fetchcp(rower,theworkouts,table='cpdata'):
|
||||
|
||||
|
||||
# create a new workout from manually entered data
|
||||
def create_row_df(distance,duration,startdatetime):
|
||||
def create_row_df(r,distance,duration,startdatetime,
|
||||
title = 'Manually added workout',notes='',
|
||||
workouttype='rower'):
|
||||
|
||||
print startdatetime
|
||||
|
||||
nr_strokes = int(distance/10.)
|
||||
|
||||
unixstarttime = arrow.get(startdatetime).timestamp
|
||||
|
||||
print unixstarttime,'aap'
|
||||
|
||||
totalseconds = duration.hour*3600.
|
||||
totalseconds += duration.minute*60.
|
||||
totalseconds += duration.second
|
||||
@@ -584,19 +583,42 @@ def create_row_df(distance,duration,startdatetime):
|
||||
|
||||
unixtime = unixstarttime + elapsed
|
||||
|
||||
print unixtime
|
||||
|
||||
pace = 500.*totalseconds/distance
|
||||
|
||||
if workouttype in ['rower','slides','dynamic']:
|
||||
velo = distance/totalseconds
|
||||
power = 2.8*velo**3
|
||||
else:
|
||||
power = 0
|
||||
|
||||
df = pd.DataFrame({
|
||||
'TimeStamp (sec)': unixtime,
|
||||
' Horizontal (meters)': d,
|
||||
' Cadence (stokes/min)': spm,
|
||||
' Stroke500mPace (sec/500m)':pace,
|
||||
' ElapsedTime (sec)':elapsed,
|
||||
' Power (watts)':power,
|
||||
})
|
||||
|
||||
return df
|
||||
timestr = strftime("%Y%m%d-%H%M%S")
|
||||
|
||||
csvfilename = 'media/df_' + timestr + '.csv'
|
||||
df[' ElapsedTime (sec)'] = df['TimeStamp (sec)']
|
||||
|
||||
row = rrdata(df=df)
|
||||
|
||||
row.write_csv(csvfilename, gzip = True)
|
||||
|
||||
id, message = save_workout_database(csvfilename, r,
|
||||
title=title,
|
||||
notes=notes,
|
||||
dosmooth=False,
|
||||
workouttype=workouttype,
|
||||
consistencychecks=False,
|
||||
totaltime=totalseconds)
|
||||
|
||||
return (id, message)
|
||||
|
||||
|
||||
# Processes painsled CSV file to database
|
||||
|
||||
|
||||
Reference in New Issue
Block a user