Private
Public Access
1
0

manual workout form - datetime is 48 years off

This commit is contained in:
Sander Roosendaal
2017-11-18 17:03:18 -07:00
parent 0f88d004b1
commit b21c0c122f
5 changed files with 168 additions and 1 deletions

View File

@@ -555,6 +555,49 @@ def fetchcp(rower,theworkouts,table='cpdata'):
return [],[],avgpower2
# create a new workout from manually entered data
def create_row_df(distance,duration,startdatetime):
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
totalseconds += duration.microsecond/1.e6
spm = 60.*nr_strokes/totalseconds
step = totalseconds/float(nr_strokes)
elapsed = np.arange(0,totalseconds+step,step)
dstep = distance/float(nr_strokes)
d = np.arange(0,distance+dstep,dstep)
unixtime = unixstarttime + elapsed
print unixtime
pace = 500.*totalseconds/distance
df = pd.DataFrame({
'TimeStamp (sec)': unixtime,
' Horizontal (meters)': d,
' Cadence (stokes/min)': spm,
' Stroke500mPace (sec/500m)':pace,
' ElapsedTime (sec)':elapsed,
})
return df
# Processes painsled CSV file to database