Private
Public Access
1
0

all dicts through ajax

This commit is contained in:
Sander Roosendaal
2020-05-06 22:13:30 +02:00
parent 4711a9f860
commit 6c1d176c40
2 changed files with 18 additions and 32 deletions

View File

@@ -4716,24 +4716,13 @@ def history_view(request,userid=0):
a_workouts = g_workouts.filter(workouttype=wtype)
wmeters, whours, wminutes = get_totals(a_workouts)
ddict = {}
ddict['id'] = wtype
ddict['wtype'] = mytypes.workouttypes_ordered[wtype]
ddict['distance'] = wmeters
ddict['duration'] = "{whours}:{wminutes:02d}".format(
whours=whours,
wminutes=wminutes
)
ddf = getsmallrowdata_db(columns,ids=[w.id for w in a_workouts])
try:
ddf['deltat'] = ddf['time'].diff()
except KeyError:
pass
ddf = dataprep.clean_df_stats(ddf,workstrokesonly=True,
ignoreadvanced=True)
ddict['hrmean'] = int(wavg(ddf,'hr','deltat'))
ddict['hrmax'] = ddf['hr'].max().astype(int)
ddict['powermean'] = int(wavg(ddf,'power','deltat'))
ddict['powermax'] = ddf['power'].max().astype(int)
ddict['nrworkouts'] = a_workouts.count()
listofdicts.append(ddict)
@@ -4741,22 +4730,7 @@ def history_view(request,userid=0):
# interactive hr pie chart
totalscript = ''
totaldiv = get_call()
if typeselect == 'All':
pass
#totalscript,totaldiv = interactive_hr_piechart(df,r,'All Workouts')
else:
a_workouts = g_workouts.filter(workouttype=typeselect)
ddf = getsmallrowdata_db(columns,ids=[w.id for w in a_workouts])
try:
ddf['deltat'] = ddf['time'].diff()
except KeyError:
pass
ddf = dataprep.clean_df_stats(ddf,workstrokesonly=True,
ignoreadvanced=True)
#totalscript, totaldiv = interactive_hr_piechart(ddf,r,mytypes.workouttypes_ordered[typeselect])
# interactive power pie chart
totalsdict = {}
totalsdict['duration'] = "{totalhours}:{totalminutes}".format(
totalhours=totalhours,
@@ -4872,6 +4846,7 @@ def history_view_data(request,userid=0):
wmeters, whours, wminutes = get_totals(a_workouts)
ddict = {}
ddict['wtype'] = mytypes.workouttypes_ordered[wtype]
ddict['id'] = wtype
ddict['distance'] = wmeters
ddict['duration'] = "{whours}:{wminutes:02d}".format(
whours=whours,