Merge branch 'release/v6.39'
This commit is contained in:
+6
-3
@@ -172,7 +172,7 @@ def workout_summary_to_df(
|
|||||||
id=w.id
|
id=w.id
|
||||||
)
|
)
|
||||||
csv_links.append(csv_link)
|
csv_links.append(csv_link)
|
||||||
trimps.append(workout_trimp(w))
|
trimps.append(workout_trimp(w)[0])
|
||||||
rscore = workout_rscore(w)
|
rscore = workout_rscore(w)
|
||||||
rscores.append(int(rscore[0]))
|
rscores.append(int(rscore[0]))
|
||||||
|
|
||||||
@@ -2302,17 +2302,20 @@ def dataprep(rowdatadf, id=0, bands=True, barchart=True, otwpower=True,
|
|||||||
engine.dispose()
|
engine.dispose()
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
def workout_trimp(workout):
|
def workout_trimp(workout):
|
||||||
r = workout.user
|
r = workout.user
|
||||||
|
hrftp = (r.an+r.tr)/2.
|
||||||
df,row = getrowdata_db(id=workout.id)
|
df,row = getrowdata_db(id=workout.id)
|
||||||
df = clean_df_stats(df,workstrokesonly=False)
|
df = clean_df_stats(df,workstrokesonly=False)
|
||||||
if df.empty:
|
if df.empty:
|
||||||
df,row = getrowdata_db(id=workout.id)
|
df,row = getrowdata_db(id=workout.id)
|
||||||
df = clean_df_stats(df,workstrokesonly=False)
|
df = clean_df_stats(df,workstrokesonly=False)
|
||||||
trimp = calc_trimp(df,r.sex,r.max,r.rest)
|
trimp,hrtss = calc_trimp(df,r.sex,r.max,r.rest,hrftp)
|
||||||
trimp = int(trimp)
|
trimp = int(trimp)
|
||||||
|
hrtss = int(hrtss)
|
||||||
|
|
||||||
return trimp
|
return trimp,hrtss
|
||||||
|
|
||||||
def workout_rscore(w):
|
def workout_rscore(w):
|
||||||
r = w.user
|
r = w.user
|
||||||
|
|||||||
@@ -352,6 +352,31 @@ class DateRangeForm(forms.Form):
|
|||||||
class Meta:
|
class Meta:
|
||||||
fields = ['startdate','enddate']
|
fields = ['startdate','enddate']
|
||||||
|
|
||||||
|
class FitnessMetricForm(forms.Form):
|
||||||
|
startdate = forms.DateField(
|
||||||
|
initial=timezone.now()-datetime.timedelta(days=365),
|
||||||
|
# widget=SelectDateWidget(years=range(1990,2050)),
|
||||||
|
widget=AdminDateWidget(),
|
||||||
|
label='Start Date')
|
||||||
|
enddate = forms.DateField(
|
||||||
|
initial=timezone.now(),
|
||||||
|
widget=AdminDateWidget(),
|
||||||
|
label='End Date')
|
||||||
|
|
||||||
|
modechoices = (
|
||||||
|
('rower','indoor rower'),
|
||||||
|
('water','on the water')
|
||||||
|
)
|
||||||
|
|
||||||
|
mode = forms.ChoiceField(required=True,
|
||||||
|
choices=modechoices,
|
||||||
|
initial='rower',
|
||||||
|
label='Workout Mode'
|
||||||
|
)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
fields = ['startdate','enddate','mode']
|
||||||
|
|
||||||
class SessionDateShiftForm(forms.Form):
|
class SessionDateShiftForm(forms.Form):
|
||||||
shiftstartdate = forms.DateField(
|
shiftstartdate = forms.DateField(
|
||||||
initial=timezone.now(),
|
initial=timezone.now(),
|
||||||
|
|||||||
+132
-1
@@ -57,6 +57,7 @@ thetimezone = get_current_timezone()
|
|||||||
from scipy.stats import linregress,percentileofscore
|
from scipy.stats import linregress,percentileofscore
|
||||||
from scipy import optimize
|
from scipy import optimize
|
||||||
from scipy.signal import savgol_filter
|
from scipy.signal import savgol_filter
|
||||||
|
from scipy.interpolate import griddata
|
||||||
|
|
||||||
|
|
||||||
import stravastuff
|
import stravastuff
|
||||||
@@ -628,7 +629,137 @@ def interactive_forcecurve(theworkouts,workstrokesonly=False):
|
|||||||
|
|
||||||
return [script,div,js_resources,css_resources]
|
return [script,div,js_resources,css_resources]
|
||||||
|
|
||||||
|
def fitnessmetric_chart(fitnessmetrics,user,workoutmode='rower'):
|
||||||
|
|
||||||
|
power4min = [int(m.PowerFourMin) for m in fitnessmetrics]
|
||||||
|
power2k = [int(m.PowerTwoK) for m in fitnessmetrics]
|
||||||
|
power1hr = [int(m.PowerOneHour) for m in fitnessmetrics]
|
||||||
|
dates = [m.date for m in fitnessmetrics]
|
||||||
|
mode = [m.workoutmode for m in fitnessmetrics]
|
||||||
|
|
||||||
|
df = pd.DataFrame(
|
||||||
|
{'power4min':power4min,
|
||||||
|
'power2k':power2k,
|
||||||
|
'power1hr':power1hr,
|
||||||
|
'date':dates,
|
||||||
|
'dates':dates,
|
||||||
|
'mode':mode
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
delta = df['power4min'].astype('int').diff()
|
||||||
|
|
||||||
|
mask = delta == 0
|
||||||
|
|
||||||
|
df.loc[mask,'power4min'] = np.nan
|
||||||
|
df.dropna(inplace=True,axis=0,how='any')
|
||||||
|
|
||||||
|
|
||||||
|
df = df[df['power2k']>0]
|
||||||
|
df = df[df['mode']==workoutmode]
|
||||||
|
|
||||||
|
groups = df.groupby(by='date').max()
|
||||||
|
|
||||||
|
power4min = groups['power4min']
|
||||||
|
date = groups['dates']
|
||||||
|
power2k = groups['power2k']
|
||||||
|
power1hr = groups['power1hr']
|
||||||
|
|
||||||
|
source = ColumnDataSource(
|
||||||
|
data = dict(
|
||||||
|
power4min = power4min,
|
||||||
|
power2k = power2k,
|
||||||
|
date = date,
|
||||||
|
power1hr = power1hr,
|
||||||
|
fdate=groups['dates'].map(lambda x: x.strftime('%d-%m-%Y')) )
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# fit
|
||||||
|
|
||||||
|
resampled = groups.set_index('dates')
|
||||||
|
resampled.index = pd.to_datetime(resampled.index)
|
||||||
|
resampled = resampled.resample('D').interpolate(
|
||||||
|
method='linear',order=2)
|
||||||
|
|
||||||
|
power4min = resampled['power4min']
|
||||||
|
date = resampled.index.values
|
||||||
|
power2k = resampled['power2k']
|
||||||
|
power1hr = resampled['power1hr']
|
||||||
|
|
||||||
|
source2 = ColumnDataSource(
|
||||||
|
data = dict(
|
||||||
|
power4min = power4min,
|
||||||
|
power2k = power2k,
|
||||||
|
date = date,
|
||||||
|
power1hr = power1hr,
|
||||||
|
fdate=resampled.index.map(lambda x: x.strftime('%d-%m-%Y')) )
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,resize,crosshair'
|
||||||
|
|
||||||
|
plot = Figure(tools=TOOLS,toolbar_location="above",
|
||||||
|
toolbar_sticky=False,width=900,
|
||||||
|
x_axis_type='datetime')
|
||||||
|
|
||||||
|
# add watermark
|
||||||
|
plot.extra_y_ranges = {"watermark": watermarkrange}
|
||||||
|
plot.extra_x_ranges = {"watermark": watermarkrange}
|
||||||
|
|
||||||
|
plot.image_url([watermarkurl],watermarkx,watermarky,
|
||||||
|
watermarkw,watermarkh,
|
||||||
|
global_alpha=watermarkalpha,
|
||||||
|
w_units='screen',
|
||||||
|
h_units='screen',
|
||||||
|
anchor=watermarkanchor,
|
||||||
|
dilate=True,
|
||||||
|
x_range_name = "watermark",
|
||||||
|
y_range_name = "watermark",
|
||||||
|
)
|
||||||
|
|
||||||
|
plot.circle('date','power2k',source=source,fill_color='red',size=10,
|
||||||
|
legend='2k power')
|
||||||
|
|
||||||
|
|
||||||
|
plot.circle('date','power1hr',source=source,fill_color='blue',size=10,
|
||||||
|
legend='1 hr power')
|
||||||
|
|
||||||
|
plot.circle('date','power4min',source=source,fill_color='green',size=10,
|
||||||
|
legend='4 min power')
|
||||||
|
|
||||||
|
plot.line('date','power4min',source=source2,color='green')
|
||||||
|
plot.line('date','power2k',source=source2,color='red')
|
||||||
|
plot.line('date','power1hr',source=source2,color='blue')
|
||||||
|
|
||||||
|
plot.xaxis.axis_label = 'Date'
|
||||||
|
plot.yaxis.axis_label = 'Power (W)'
|
||||||
|
|
||||||
|
plot.xaxis.formatter = DatetimeTickFormatter(
|
||||||
|
days=["%d %B %Y"],
|
||||||
|
months=["%d %B %Y"],
|
||||||
|
years=["%d %B %Y"],
|
||||||
|
)
|
||||||
|
|
||||||
|
plot.xaxis.major_label_orientation = pi/4
|
||||||
|
|
||||||
|
plot.y_range = Range1d(0,1.5*max(power4min))
|
||||||
|
plot.title.text = 'Power levels from workouts '+user.first_name
|
||||||
|
|
||||||
|
hover = plot.select(dict(type=HoverTool))
|
||||||
|
|
||||||
|
hover.tooltips = OrderedDict([
|
||||||
|
('Power 4 minutes','@power4min'),
|
||||||
|
('Power 2000 m','@power2k'),
|
||||||
|
('Power 1 hour','@power1hr'),
|
||||||
|
('Date','@fdate'),
|
||||||
|
])
|
||||||
|
|
||||||
|
script,div = components(plot)
|
||||||
|
|
||||||
|
return [script,div]
|
||||||
|
|
||||||
def interactive_histoall(theworkouts):
|
def interactive_histoall(theworkouts):
|
||||||
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,resize,crosshair'
|
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,resize,crosshair'
|
||||||
|
|||||||
+6
-2
@@ -334,7 +334,7 @@ This value should be fairly constant across all stroke rates.""",
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def calc_trimp(df,sex,hrmax,hrmin):
|
def calc_trimp(df,sex,hrmax,hrmin,hrftp):
|
||||||
if sex == 'male':
|
if sex == 'male':
|
||||||
f = 1.92
|
f = 1.92
|
||||||
else:
|
else:
|
||||||
@@ -343,10 +343,14 @@ def calc_trimp(df,sex,hrmax,hrmin):
|
|||||||
dt = df['time'].diff()/6.e4
|
dt = df['time'].diff()/6.e4
|
||||||
|
|
||||||
hrr = (df['hr']-hrmin)/(hrmax-hrmin)
|
hrr = (df['hr']-hrmin)/(hrmax-hrmin)
|
||||||
|
hrrftp = (hrftp-hrmin)/(hrmax-hrmin)
|
||||||
|
trimp1hr = 60*hrrftp*0.64*np.exp(f*hrrftp)
|
||||||
trimpdata = dt*hrr*0.64*np.exp(f*hrr)
|
trimpdata = dt*hrr*0.64*np.exp(f*hrr)
|
||||||
trimp = trimpdata.sum()
|
trimp = trimpdata.sum()
|
||||||
|
|
||||||
return trimp
|
hrtss = 100*trimp/trimp1hr
|
||||||
|
|
||||||
|
return trimp,hrtss
|
||||||
|
|
||||||
|
|
||||||
def getagegrouprecord(age,sex='male',weightcategory='hwt',
|
def getagegrouprecord(age,sex='male',weightcategory='hwt',
|
||||||
|
|||||||
@@ -111,8 +111,13 @@ def get_session_metrics(ps):
|
|||||||
for w in ws:
|
for w in ws:
|
||||||
distancev += w.distance
|
distancev += w.distance
|
||||||
durationv += timefield_to_seconds_duration(w.duration)
|
durationv += timefield_to_seconds_duration(w.duration)
|
||||||
trimpv += dataprep.workout_trimp(w)
|
thetrimp,hrtss = dataprep.workout_trimp(w)
|
||||||
rscorev += dataprep.workout_rscore(w)[0]
|
trimpv += thetrimp
|
||||||
|
tss = dataprep.workout_rscore(w)[0]
|
||||||
|
if not np.isnan(tss) and tss != 0:
|
||||||
|
rscorev += tss
|
||||||
|
elif tss == 0:
|
||||||
|
rscorev += hrtss
|
||||||
|
|
||||||
ratio,statusv,completiondate = is_session_complete_ws(ws,ps)
|
ratio,statusv,completiondate = is_session_complete_ws(ws,ps)
|
||||||
try:
|
try:
|
||||||
@@ -181,11 +186,16 @@ def is_session_complete_ws(ws,ps):
|
|||||||
durationseconds = timefield_to_seconds_duration(w.duration)
|
durationseconds = timefield_to_seconds_duration(w.duration)
|
||||||
score += durationseconds
|
score += durationseconds
|
||||||
elif ps.sessionmode == 'TRIMP':
|
elif ps.sessionmode == 'TRIMP':
|
||||||
trimp = dataprep.workout_trimp(w)
|
trimp,hrtss = dataprep.workout_trimp(w)
|
||||||
score += trimp
|
score += trimp
|
||||||
elif ps.sessionmode == 'rScore':
|
elif ps.sessionmode == 'rScore':
|
||||||
rscore = dataprep.workout_rscore(w)[0]
|
rscore = dataprep.workout_rscore(w)[0]
|
||||||
score += rscore
|
if not np.isnan(rscore) and rscore != 0:
|
||||||
|
score += rscore
|
||||||
|
elif rscore == 0:
|
||||||
|
trimp,hrtss = dataprep.workout_trimp(w)
|
||||||
|
score += hrtss
|
||||||
|
|
||||||
if not completiondate and score>=cratiomin*value:
|
if not completiondate and score>=cratiomin*value:
|
||||||
completiondate = w.date
|
completiondate = w.date
|
||||||
|
|
||||||
|
|||||||
+25
-20
@@ -743,26 +743,7 @@ def handle_updateergcp(rower_id,workoutfilenames,debug=False,**kwargs):
|
|||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
@app.task
|
def cp_from_workoutids(workoutids,debug=False):
|
||||||
def handle_updatefitnessmetric(user_id,mode,workoutids,debug=False,
|
|
||||||
**kwargs):
|
|
||||||
|
|
||||||
powerfourmin = -1
|
|
||||||
power2k = -1
|
|
||||||
powerhour = -1
|
|
||||||
|
|
||||||
mdict = {
|
|
||||||
'user_id': user_id,
|
|
||||||
'PowerFourMin': powerfourmin,
|
|
||||||
'PowerTwoK': power2k,
|
|
||||||
'PowerOneHour': powerhour,
|
|
||||||
'workoutmode': mode,
|
|
||||||
'last_workout': max(workoutids),
|
|
||||||
'date': timezone.now().strftime('%Y-%m-%d'),
|
|
||||||
}
|
|
||||||
|
|
||||||
result = fitnessmetric_to_sql(mdict,debug=debug,doclean=False)
|
|
||||||
|
|
||||||
columns = ['power','workoutid','time']
|
columns = ['power','workoutid','time']
|
||||||
df = getsmallrowdata_db(columns,ids=workoutids,debug=debug)
|
df = getsmallrowdata_db(columns,ids=workoutids,debug=debug)
|
||||||
df.dropna(inplace=True,axis=0)
|
df.dropna(inplace=True,axis=0)
|
||||||
@@ -821,6 +802,30 @@ def handle_updatefitnessmetric(user_id,mode,workoutids,debug=False,
|
|||||||
|
|
||||||
power2k = fitfunc(p1,t3)
|
power2k = fitfunc(p1,t3)
|
||||||
|
|
||||||
|
return powerfourmin,power2k,powerhour
|
||||||
|
|
||||||
|
|
||||||
|
@app.task
|
||||||
|
def handle_updatefitnessmetric(user_id,mode,workoutids,debug=False,
|
||||||
|
**kwargs):
|
||||||
|
|
||||||
|
powerfourmin = -1
|
||||||
|
power2k = -1
|
||||||
|
powerhour = -1
|
||||||
|
|
||||||
|
mdict = {
|
||||||
|
'user_id': user_id,
|
||||||
|
'PowerFourMin': powerfourmin,
|
||||||
|
'PowerTwoK': power2k,
|
||||||
|
'PowerOneHour': powerhour,
|
||||||
|
'workoutmode': mode,
|
||||||
|
'last_workout': max(workoutids),
|
||||||
|
'date': timezone.now().strftime('%Y-%m-%d'),
|
||||||
|
}
|
||||||
|
|
||||||
|
result = fitnessmetric_to_sql(mdict,debug=debug,doclean=False)
|
||||||
|
|
||||||
|
powerfourmin,power2k,powerhour = cp_from_workoutids(workoutids,debug=debug)
|
||||||
|
|
||||||
mdict = {
|
mdict = {
|
||||||
'user_id': user_id,
|
'user_id': user_id,
|
||||||
|
|||||||
@@ -126,7 +126,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_6 prefix_6 alpha">
|
<div class="grid_6 prefix_6 alpha">
|
||||||
<div class="grid_2 suffix_4 alpha">
|
<div class="grid_2 alpha">
|
||||||
<p>
|
<p>
|
||||||
{% if user|is_promember %}
|
{% if user|is_promember %}
|
||||||
<a class="button blue small" href="/rowers/ote-ranking">OTE Critical Power</a>
|
<a class="button blue small" href="/rowers/ote-ranking">OTE Critical Power</a>
|
||||||
@@ -138,6 +138,19 @@
|
|||||||
Analyse power vs piece duration to make predictions, for erg pieces.
|
Analyse power vs piece duration to make predictions, for erg pieces.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="grid_2 suffix_2 alpha">
|
||||||
|
<p>
|
||||||
|
{% if user|is_planmember %}
|
||||||
|
<a class="button blue small" href="/rowers/fitness-progress">Lab</a>
|
||||||
|
{% else %}
|
||||||
|
<a class="button blue small" href="/rowers/promembership">Lab</a>
|
||||||
|
{% endif %}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Undisclosed new functionality. This is still experimental and
|
||||||
|
may not make sense.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,125 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% load staticfiles %}
|
||||||
|
{% load rowerfilters %}
|
||||||
|
|
||||||
|
{% block title %}Rowsandall Fitness Progress {% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
|
||||||
|
// Get the form fields and hidden div
|
||||||
|
var checkbox = $("#id_water");
|
||||||
|
var hidden = $("#id_waterboattype");
|
||||||
|
|
||||||
|
|
||||||
|
// Hide the fields.
|
||||||
|
// Use JS to do this in case the user doesn't have JS
|
||||||
|
// enabled.
|
||||||
|
|
||||||
|
hidden.hide();
|
||||||
|
|
||||||
|
|
||||||
|
// Setup an event listener for when the state of the
|
||||||
|
// checkbox changes.
|
||||||
|
checkbox.change(function() {
|
||||||
|
// Check to see if the checkbox is checked.
|
||||||
|
// If it is, show the fields and populate the input.
|
||||||
|
// If not, hide the fields.
|
||||||
|
if (checkbox.is(':checked')) {
|
||||||
|
// Show the hidden fields.
|
||||||
|
hidden.show();
|
||||||
|
} else {
|
||||||
|
// Make sure that the hidden fields are indeed
|
||||||
|
// hidden.
|
||||||
|
hidden.hide();
|
||||||
|
|
||||||
|
// You may also want to clear the value of the
|
||||||
|
// hidden fields here. Just in case somebody
|
||||||
|
// shows the fields, enters data to them and then
|
||||||
|
// unticks the checkbox.
|
||||||
|
//
|
||||||
|
// This would do the job:
|
||||||
|
//
|
||||||
|
// $("#hidden_field").val("");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="/static/js/bokeh-0.12.3.min.js"></script>
|
||||||
|
<script async="true" type="text/javascript">
|
||||||
|
Bokeh.set_log_level("info");
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{{ chartscript |safe }}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Set things up to resize the plot on a window resize. You can play with
|
||||||
|
// the arguments of resize_width_height() to change the plot's behavior.
|
||||||
|
var plot_resize_setup = function () {
|
||||||
|
var plotid = Object.keys(Bokeh.index)[0]; // assume we have just one plot
|
||||||
|
var plot = Bokeh.index[plotid];
|
||||||
|
var plotresizer = function() {
|
||||||
|
// arguments: use width, use height, maintain aspect ratio
|
||||||
|
plot.resize_width_height(true, false, false);
|
||||||
|
};
|
||||||
|
window.addEventListener('resize', plotresizer);
|
||||||
|
plotresizer();
|
||||||
|
};
|
||||||
|
window.addEventListener('load', plot_resize_setup);
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
/* Need this to get the page in "desktop mode"; not having an infinite height.*/
|
||||||
|
html, body {height: 100%; margin:5px;}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="title" class="grid_12 alpha">
|
||||||
|
<div class="grid_6 suffix_6 alpha">
|
||||||
|
<form enctype="multipart/form-data" method="post">
|
||||||
|
<table>
|
||||||
|
{{ form.as_table }}
|
||||||
|
</table>
|
||||||
|
{% csrf_token %}
|
||||||
|
<div class="grid_2 prefix_4 alpha">
|
||||||
|
<input name='daterange' class="button green" type="submit" value="Submit">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="grid_10 alpha">
|
||||||
|
{% if therower.user %}
|
||||||
|
<h3>{{ therower.user.first_name }} Power Estimates</h3>
|
||||||
|
{% else %}
|
||||||
|
<h3>{{ user.first_name }} Power Estimates</h3>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="grid_2 omega">
|
||||||
|
{% if user.is_authenticated and user|is_manager %}
|
||||||
|
<div class="grid_2 alpha dropdown">
|
||||||
|
<button class="grid_2 alpha button green small dropbtn">
|
||||||
|
{{ therower.user.first_name }} {{ therower.user.last_name }}
|
||||||
|
</button>
|
||||||
|
<div class="dropdown-content">
|
||||||
|
{% for member in user|team_members %}
|
||||||
|
<a class="button green small"
|
||||||
|
href="/rowers/fitness-progress/rower/{{ member.id }}/{{ mode }}">{{ member.first_name }} {{ member.last_name }}</a>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="graph" class="grid_12 alpha">
|
||||||
|
|
||||||
|
{{ the_div|safe }}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
<a class="button small gray" href="/rowers/list-courses">Courses</a>
|
<a class="button small gray" href="/rowers/list-courses">Courses</a>
|
||||||
</div>
|
</div>
|
||||||
{% for ps in plannedsessions %}
|
{% for ps in plannedsessions %}
|
||||||
<div class="grid_12 alpha">
|
<div class="grid_12 alpha" style="page-break-before: always, page-break-inside: avoid">
|
||||||
<h1><a href="/rowers/sessions/{{ ps.id }}">Session {{ ps.name }}</a></h1>
|
<h1><a href="/rowers/sessions/{{ ps.id }}">Session {{ ps.name }}</a></h1>
|
||||||
<table class="listtable shortpadded" width="80%">
|
<table class="listtable shortpadded" width="80%">
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -131,6 +131,11 @@ def is_manager(user):
|
|||||||
r = Rower.objects.get(user=user)
|
r = Rower.objects.get(user=user)
|
||||||
return r.rowerplan == 'coach'
|
return r.rowerplan == 'coach'
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def is_planmember(user):
|
||||||
|
r = Rower.objects.get(user=user)
|
||||||
|
return r.rowerplan == 'plan' or r.rowerplan == 'coach'
|
||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
def user_teams(user):
|
def user_teams(user):
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -173,6 +173,9 @@ urlpatterns = [
|
|||||||
url(r'^record-progress/(?P<id>.*)$',views.post_progress),
|
url(r'^record-progress/(?P<id>.*)$',views.post_progress),
|
||||||
url(r'^record-progress$',views.post_progress),
|
url(r'^record-progress$',views.post_progress),
|
||||||
url(r'^list-graphs/$',views.graphs_view),
|
url(r'^list-graphs/$',views.graphs_view),
|
||||||
|
url(r'^fitness-progress/$',views.fitnessmetric_view),
|
||||||
|
url(r'^fitness-progress/rower/(?P<id>\d+)$',views.fitnessmetric_view),
|
||||||
|
url(r'^fitness-progress/rower/(?P<id>\d+)/(?P<mode>\w+.*)$',views.fitnessmetric_view),
|
||||||
url(r'^(?P<theuser>\d+)/ote-bests/(?P<startdatestring>\w+.*)/(?P<enddatestring>\w+.*)$',views.rankings_view),
|
url(r'^(?P<theuser>\d+)/ote-bests/(?P<startdatestring>\w+.*)/(?P<enddatestring>\w+.*)$',views.rankings_view),
|
||||||
url(r'^(?P<theuser>\d+)/ote-bests/(?P<deltadays>\d+)$',views.rankings_view),
|
url(r'^(?P<theuser>\d+)/ote-bests/(?P<deltadays>\d+)$',views.rankings_view),
|
||||||
url(r'^ote-bests/(?P<startdatestring>\w+.*)/(?P<enddatestring>\w+.*)$',views.rankings_view),
|
url(r'^ote-bests/(?P<startdatestring>\w+.*)/(?P<enddatestring>\w+.*)$',views.rankings_view),
|
||||||
|
|||||||
+48
-1
@@ -46,6 +46,7 @@ from django.core.mail import send_mail, BadHeaderError
|
|||||||
from rowers.forms import (
|
from rowers.forms import (
|
||||||
SummaryStringForm,IntervalUpdateForm,StrokeDataForm,
|
SummaryStringForm,IntervalUpdateForm,StrokeDataForm,
|
||||||
StatsOptionsForm,PredictedPieceForm,DateRangeForm,DeltaDaysForm,
|
StatsOptionsForm,PredictedPieceForm,DateRangeForm,DeltaDaysForm,
|
||||||
|
FitnessMetricForm,
|
||||||
EmailForm, RegistrationForm, RegistrationFormTermsOfService,
|
EmailForm, RegistrationForm, RegistrationFormTermsOfService,
|
||||||
RegistrationFormUniqueEmail,RegistrationFormSex,
|
RegistrationFormUniqueEmail,RegistrationFormSex,
|
||||||
CNsummaryForm,UpdateWindForm,
|
CNsummaryForm,UpdateWindForm,
|
||||||
@@ -3062,6 +3063,46 @@ def cum_flex(request,theuser=0,
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@user_passes_test(hasplannedsessions,login_url="/",redirect_field_name=None)
|
||||||
|
def fitnessmetric_view(request,id=0,mode='rower',
|
||||||
|
startdate=timezone.now()-timezone.timedelta(days=365),
|
||||||
|
enddate=timezone.now()):
|
||||||
|
if id==0:
|
||||||
|
id = request.user.id
|
||||||
|
|
||||||
|
theuser = User.objects.get(id=id)
|
||||||
|
therower = Rower.objects.get(user=theuser)
|
||||||
|
|
||||||
|
|
||||||
|
if request.method == 'POST':
|
||||||
|
form = FitnessMetricForm(request.POST)
|
||||||
|
if form.is_valid():
|
||||||
|
startdate = form.cleaned_data['startdate']
|
||||||
|
enddate = form.cleaned_data['enddate']
|
||||||
|
mode = form.cleaned_data['mode']
|
||||||
|
else:
|
||||||
|
form = FitnessMetricForm()
|
||||||
|
|
||||||
|
fitnessmetrics = PowerTimeFitnessMetric.objects.filter(
|
||||||
|
user=theuser,
|
||||||
|
date__gte=startdate,
|
||||||
|
date__lte=enddate)
|
||||||
|
|
||||||
|
script,thediv = fitnessmetric_chart(
|
||||||
|
fitnessmetrics,theuser,
|
||||||
|
workoutmode=mode
|
||||||
|
)
|
||||||
|
|
||||||
|
return render(request,'fitnessmetric.html',
|
||||||
|
{
|
||||||
|
'therower':therower,
|
||||||
|
'chartscript':script,
|
||||||
|
'the_div':thediv,
|
||||||
|
'mode':mode,
|
||||||
|
'form':form,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
# Show the EMpower Oarlock generated Stroke Profile
|
# Show the EMpower Oarlock generated Stroke Profile
|
||||||
@user_passes_test(ispromember,login_url="/",redirect_field_name=None)
|
@user_passes_test(ispromember,login_url="/",redirect_field_name=None)
|
||||||
def workout_forcecurve_view(request,id=0,workstrokesonly=False):
|
def workout_forcecurve_view(request,id=0,workstrokesonly=False):
|
||||||
@@ -7832,7 +7873,7 @@ def workout_stats_view(request,id=0,message="",successmessage=""):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
# TRIMP
|
# TRIMP
|
||||||
trimp = dataprep.workout_trimp(w)
|
trimp,hrtss = dataprep.workout_trimp(w)
|
||||||
|
|
||||||
otherstats['trimp'] = {
|
otherstats['trimp'] = {
|
||||||
'verbose_name': 'TRIMP',
|
'verbose_name': 'TRIMP',
|
||||||
@@ -7840,6 +7881,12 @@ def workout_stats_view(request,id=0,message="",successmessage=""):
|
|||||||
'unit': ''
|
'unit': ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
otherstats['hrScore'] = {
|
||||||
|
'verbose_name': 'rScore (HR)',
|
||||||
|
'value': hrtss,
|
||||||
|
'unit':''
|
||||||
|
}
|
||||||
|
|
||||||
return render(request,
|
return render(request,
|
||||||
'workoutstats.html',
|
'workoutstats.html',
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -85,7 +85,21 @@ a:hover {
|
|||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
h1 {
|
||||||
|
page-break-before: always;
|
||||||
|
page-break-after: avoid;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3, h4 {
|
||||||
|
page-break-after: avoid;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre, blockquote, table {
|
||||||
|
page-break-inside: avoid;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
|
|||||||
Reference in New Issue
Block a user