Merge branch 'feature/historyfix' into develop
This commit is contained in:
@@ -351,6 +351,7 @@ def interactive_hr_piechart(df,rower,title,totalseconds=0):
|
||||
data = pd.Series(datadict).reset_index(name='value').rename(columns={'index':'zone'})
|
||||
data['angle'] = data['value']/data['value'].sum() * 2*pi
|
||||
data['color'] = colors
|
||||
data['zone'] = ['<ut2','ut2','ut1','at','tr','an']
|
||||
data['totaltime'] = pd.Series([pretty_timedelta(v) for v in data['value']])
|
||||
|
||||
|
||||
@@ -367,7 +368,7 @@ def interactive_hr_piechart(df,rower,title,totalseconds=0):
|
||||
|
||||
z.wedge(x=0,y=1, radius=0.4,
|
||||
start_angle=cumsum('angle',include_zero=True), end_angle=cumsum('angle'),
|
||||
line_color='white',fill_color='color',source=data,legend_label='zone')
|
||||
line_color='white',fill_color='color',source=data,legend='zone')
|
||||
|
||||
|
||||
|
||||
@@ -438,7 +439,7 @@ def interactive_workouttype_piechart(workouts):
|
||||
|
||||
p.wedge(x=0, y=1, radius=0.4,
|
||||
start_angle=cumsum('angle', include_zero=True), end_angle=cumsum('angle'),
|
||||
line_color="white", fill_color='color', source=data,legend_label='type', )
|
||||
line_color="white", fill_color='color', source=data,legend='type', )
|
||||
|
||||
p.axis.axis_label=None
|
||||
p.axis.visible=False
|
||||
|
||||
@@ -148,6 +148,7 @@
|
||||
console.log(window.location.protocol + '//'+window.location.host + '/rowers/history/user/{{ rower.user.id }}/data/?startdate={{ sstartdate|date:"Y-m-d" }}&enddate={{ senddate|date:"Y-m-d" }}&workouttype={{ workouttype }}&yaxis={{ yaxis }}')
|
||||
$.getJSON(window.location.protocol + '//'+window.location.host + '/rowers/history/user/{{ rower.user.id }}/data/?startdate={{ sstartdate|date:"Y-m-d" }}&enddate={{ senddate|date:"Y-m-d" }}&workouttype={{ workouttype }}&yaxis={{ yaxis }}', function(json) {
|
||||
|
||||
|
||||
var script = json.script;
|
||||
var div = json.div;
|
||||
var totalsdict = json.totalsdict
|
||||
|
||||
@@ -5226,16 +5226,19 @@ def history_view_data(request,userid=0):
|
||||
ddf['deltat'] = ddf['time'].diff().clip(lower=0)
|
||||
except KeyError:
|
||||
pass
|
||||
ddf = dataprep.clean_df_stats(ddf,workstrokesonly=True,
|
||||
|
||||
|
||||
ddf = dataprep.clean_df_stats(ddf,workstrokesonly=False,
|
||||
ignoreadvanced=True)
|
||||
|
||||
|
||||
ddict['hrmean'] = int(wavg(ddf,'hr','deltat'))
|
||||
try:
|
||||
ddict['hrmax'] = ddf['hr'].max().astype(int)
|
||||
except ValueError:
|
||||
ddict['hrmax'] = 0
|
||||
|
||||
ddict['powermean'] = int(wavg(df,'power','deltat'))
|
||||
ddict['powermean'] = int(wavg(ddf,'power','deltat'))
|
||||
ddict['powermax'] = ddf['power'].max().astype(int)
|
||||
ddict['nrworkouts'] = a_workouts.count()
|
||||
listofdicts.append(ddict)
|
||||
@@ -5275,12 +5278,17 @@ def history_view_data(request,userid=0):
|
||||
meters, hours,minutes,seconds = get_totals(a_workouts)
|
||||
totalseconds = 3600*hours+60*minutes+seconds
|
||||
ddf = getsmallrowdata_db(columns,ids=[w.id for w in a_workouts])
|
||||
|
||||
try:
|
||||
ddf['deltat'] = ddf['time'].diff().clip(lower=0)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
|
||||
ddf = dataprep.clean_df_stats(ddf,workstrokesonly=True,
|
||||
ignoreadvanced=True)
|
||||
|
||||
|
||||
totalscript, totaldiv = interactive_hr_piechart(
|
||||
ddf,r,mytypes.workouttypes_ordered[typeselect],
|
||||
totalseconds=totalseconds)
|
||||
|
||||
Reference in New Issue
Block a user