improving data export
This commit is contained in:
@@ -332,6 +332,7 @@ def workout_summary_to_df(
|
||||
|
||||
types = []
|
||||
names = []
|
||||
ids = []
|
||||
startdatetimes = []
|
||||
timezones = []
|
||||
distances = []
|
||||
@@ -346,11 +347,15 @@ def workout_summary_to_df(
|
||||
goldstandards = []
|
||||
goldstandarddurations = []
|
||||
rscores = []
|
||||
hrtss = []
|
||||
trimps = []
|
||||
rankingpieces = []
|
||||
boattypes = []
|
||||
|
||||
for w in ws:
|
||||
types.append(w.workouttype)
|
||||
names.append(w.name)
|
||||
ids.append(encoder.encode_hex(w.id))
|
||||
startdatetimes.append(w.startdatetime)
|
||||
timezones.append(w.timezone)
|
||||
distances.append(w.distance)
|
||||
@@ -358,6 +363,7 @@ def workout_summary_to_df(
|
||||
weightcategories.append(w.weightcategory)
|
||||
adaptivetypes.append(w.adaptiveclass)
|
||||
weightvalues.append(w.weightvalue)
|
||||
boattypes.append(w.boattype)
|
||||
notes.append(w.notes)
|
||||
tcx_link = SITE_URL+'/rowers/workout/{id}/emailtcx'.format(
|
||||
id=encoder.encode_hex(w.id)
|
||||
@@ -374,28 +380,34 @@ def workout_summary_to_df(
|
||||
trimps.append(workout_trimp(w)[0])
|
||||
rscore = workout_rscore(w)
|
||||
rscores.append(int(rscore[0]))
|
||||
hrtss.append(int(w.hrtss))
|
||||
goldstandard,goldstandardduration = workout_goldmedalstandard(w)
|
||||
goldstandards.append(int(goldstandard))
|
||||
goldstandarddurations.append(int(goldstandardduration))
|
||||
rankingpieces.append(w.rankingpiece)
|
||||
|
||||
df = pd.DataFrame({
|
||||
'ID': ids,
|
||||
'date':startdatetimes,
|
||||
'name':names,
|
||||
'link':workout_links,
|
||||
'date':startdatetimes,
|
||||
'timezone':timezones,
|
||||
'type':types,
|
||||
'boat type':boattypes,
|
||||
'distance (m)':distances,
|
||||
'duration ':durations,
|
||||
'ranking piece':rankingpieces,
|
||||
'weight category':weightcategories,
|
||||
'adaptive classification':adaptivetypes,
|
||||
'weight (kg)':weightvalues,
|
||||
'notes':notes,
|
||||
'Stroke Data TCX':tcx_links,
|
||||
'Stroke Data CSV':csv_links,
|
||||
'TRIMP Training Load':trimps,
|
||||
'TSS Training Load':rscores,
|
||||
'hrTSS Training Load':hrtss,
|
||||
'GS':goldstandards,
|
||||
'GS_secs':goldstandarddurations,
|
||||
'notes':notes,
|
||||
})
|
||||
|
||||
return df
|
||||
@@ -1046,7 +1058,8 @@ def get_workoutsummaries(userid,startdate):
|
||||
u = User.objects.get(id=userid)
|
||||
r = u.rower
|
||||
df = workout_summary_to_df(r,startdate=startdate)
|
||||
df = df.sort_values('date')
|
||||
df.drop(['Stroke Data TCX','Stroke Data CSV'],axis=1,inplace=True)
|
||||
df = df.sort_values('date',ascending=False)
|
||||
|
||||
return df
|
||||
|
||||
|
||||
Reference in New Issue
Block a user