adding splits to C2 workout export
This commit is contained in:
@@ -467,7 +467,7 @@ def createc2workoutdata_as_splits(w):
|
||||
def createc2workoutdata(w):
|
||||
filename = w.csvfilename
|
||||
try:
|
||||
row = rowingdata(filename)
|
||||
row = rowingdata(csvfile=filename)
|
||||
except IOError:
|
||||
return 0
|
||||
|
||||
@@ -478,6 +478,32 @@ def createc2workoutdata(w):
|
||||
averagehr = 0
|
||||
maxhr = 0
|
||||
|
||||
# Calculate intervalstats
|
||||
itime, idist, itype = row.intervalstats_values()
|
||||
lapnames = row.df[' lapIdx'].unique()
|
||||
nrintervals = len(itime)
|
||||
if len(lapnames != nrintervals):
|
||||
newlapnames = []
|
||||
for name in lapnames:
|
||||
newlapnames += [name,name]
|
||||
lapnames = newlapnames
|
||||
intervaldata = []
|
||||
for i in range(nrintervals):
|
||||
if itime[i]>0:
|
||||
mask = (row.df[' lapIdx'] == lapnames[i]) & (row.df[' WorkoutState'] == itype[i])
|
||||
spmav = int(row.df[' Cadence (stokes/min)'][mask].mean().astype(int))
|
||||
hrav = int(row.df[' HRCur (bpm)'][mask].mean().astype(int))
|
||||
intervaldict = {
|
||||
'type': 'distance',
|
||||
'time': int(10*itime[i]),
|
||||
'distance': int(idist[i]),
|
||||
'heart_rate': {
|
||||
'average':hrav,
|
||||
},
|
||||
'stroke_rate': spmav,
|
||||
}
|
||||
intervaldata.append(intervaldict)
|
||||
|
||||
# adding diff, trying to see if this is valid
|
||||
t = 10*row.df.loc[:,'TimeStamp (sec)'].values-10*row.df.loc[:,'TimeStamp (sec)'].iloc[0]
|
||||
try:
|
||||
@@ -547,14 +573,18 @@ def createc2workoutdata(w):
|
||||
"time": int(10*makeseconds(durationstr)),
|
||||
"weight_class": c2wc(w.weightcategory),
|
||||
"comments": w.notes,
|
||||
'stroke_rate': int(row.df[' Cadence (stokes/min)'].mean()),
|
||||
'drag_factor': int(row.dragfactor),
|
||||
"heart_rate": {
|
||||
"average": averagehr,
|
||||
"max": maxhr,
|
||||
},
|
||||
"stroke_data": stroke_data,
|
||||
'workout': {
|
||||
'splits': intervaldata,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return data
|
||||
|
||||
# Refresh Concept2 authorization token
|
||||
|
||||
Reference in New Issue
Block a user