Merge branch 'release/v5.83'
This commit is contained in:
+5
-4
@@ -1605,9 +1605,10 @@ def getsmallrowdata_db(columns, ids=[], doclean=True, workstrokesonly=True):
|
|||||||
|
|
||||||
data[c] = cdata2
|
data[c] = cdata2
|
||||||
|
|
||||||
except KeyError:
|
except (KeyError, AttributeError):
|
||||||
data[c] = 0
|
data[c] = 0
|
||||||
|
|
||||||
|
|
||||||
# convert newtons
|
# convert newtons
|
||||||
|
|
||||||
if doclean:
|
if doclean:
|
||||||
@@ -2216,7 +2217,7 @@ def dataprep(rowdatadf, id=0, bands=True, barchart=True, otwpower=True,
|
|||||||
def workout_trimp(workout):
|
def workout_trimp(workout):
|
||||||
r = workout.user
|
r = workout.user
|
||||||
df,row = getrowdata_db(id=workout.id)
|
df,row = getrowdata_db(id=workout.id)
|
||||||
df = clean_df_stats(df)
|
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)
|
||||||
@@ -2228,7 +2229,7 @@ def workout_trimp(workout):
|
|||||||
def workout_rscore(w):
|
def workout_rscore(w):
|
||||||
r = w.user
|
r = w.user
|
||||||
df,row = getrowdata_db(id=w.id)
|
df,row = getrowdata_db(id=w.id)
|
||||||
df = clean_df_stats(df)
|
df = clean_df_stats(df,workstrokesonly=False)
|
||||||
if df.empty:
|
if df.empty:
|
||||||
df,row = getrowdata_db(id=w.id)
|
df,row = getrowdata_db(id=w.id)
|
||||||
df = clean_df_stats(df,workstrokesonly=False)
|
df = clean_df_stats(df,workstrokesonly=False)
|
||||||
@@ -2248,4 +2249,4 @@ def workout_rscore(w):
|
|||||||
else:
|
else:
|
||||||
tss = 0
|
tss = 0
|
||||||
|
|
||||||
return tss
|
return tss,normp
|
||||||
|
|||||||
+15
-6
@@ -325,11 +325,14 @@ class UpdateWindForm(forms.Form):
|
|||||||
|
|
||||||
# Form to select a data range to show workouts from a certain time period
|
# Form to select a data range to show workouts from a certain time period
|
||||||
class DateRangeForm(forms.Form):
|
class DateRangeForm(forms.Form):
|
||||||
startdate = forms.DateField(initial=timezone.now()-datetime.timedelta(days=365),
|
startdate = forms.DateField(
|
||||||
widget=SelectDateWidget(years=range(1990,2050)),
|
initial=timezone.now()-datetime.timedelta(days=365),
|
||||||
|
# widget=SelectDateWidget(years=range(1990,2050)),
|
||||||
|
widget=AdminDateWidget(),
|
||||||
label='Start Date')
|
label='Start Date')
|
||||||
enddate = forms.DateField(initial=timezone.now(),
|
enddate = forms.DateField(
|
||||||
widget=SelectDateWidget(years=range(1990,2050)),
|
initial=timezone.now(),
|
||||||
|
widget=AdminDateWidget(),
|
||||||
label='End Date')
|
label='End Date')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@@ -393,12 +396,18 @@ class RegistrationFormSex(RegistrationFormUniqueEmail):
|
|||||||
('lwt','light-weight'),
|
('lwt','light-weight'),
|
||||||
)
|
)
|
||||||
|
|
||||||
birthdate = forms.DateTimeField(widget=SelectDateWidget(
|
birthdate = forms.DateTimeField(
|
||||||
years=range(timezone.now().year-100,timezone.now().year-10)),
|
widget=SelectDateWidget(),
|
||||||
initial = datetime.date(year=1970,
|
initial = datetime.date(year=1970,
|
||||||
month=4,
|
month=4,
|
||||||
day=15))
|
day=15))
|
||||||
|
|
||||||
|
def clean_birthdate(self):
|
||||||
|
dob = self.cleaned_data['birthdate']
|
||||||
|
age = (timezone.now() - dob).days/365
|
||||||
|
if age < 16:
|
||||||
|
raise forms.ValidationError('Must be at least 16 years old to register')
|
||||||
|
|
||||||
sex = forms.ChoiceField(required=True,
|
sex = forms.ChoiceField(required=True,
|
||||||
choices=sexcategories,
|
choices=sexcategories,
|
||||||
initial='not specified',
|
initial='not specified',
|
||||||
|
|||||||
@@ -2182,7 +2182,14 @@ def interactive_cum_flex_chart2(theworkouts,promember=0,
|
|||||||
try:
|
try:
|
||||||
datadf['x1'] = datadf.ix[:,xparam]
|
datadf['x1'] = datadf.ix[:,xparam]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
try:
|
||||||
datadf['x1'] = datadf['distance']
|
datadf['x1'] = datadf['distance']
|
||||||
|
except KeyError:
|
||||||
|
try:
|
||||||
|
datadf['x1'] = datadf['time']
|
||||||
|
except KeyError:
|
||||||
|
return ['','<p>No non-zero data in selection</p>','','']
|
||||||
|
|
||||||
try:
|
try:
|
||||||
datadf['y1'] = datadf.ix[:,yparam1]
|
datadf['y1'] = datadf.ix[:,yparam1]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|||||||
+5
-4
@@ -825,7 +825,8 @@ class PlannedSession(models.Model):
|
|||||||
|
|
||||||
manager = models.ForeignKey(User)
|
manager = models.ForeignKey(User)
|
||||||
|
|
||||||
name = models.CharField(max_length=150,blank=True)
|
name = models.CharField(max_length=150,blank=True,
|
||||||
|
verbose_name='Name')
|
||||||
|
|
||||||
comment = models.TextField(max_length=500,blank=True,
|
comment = models.TextField(max_length=500,blank=True,
|
||||||
)
|
)
|
||||||
@@ -913,8 +914,8 @@ class PlannedSessionForm(ModelForm):
|
|||||||
|
|
||||||
widgets = {
|
widgets = {
|
||||||
'comment': forms.Textarea,
|
'comment': forms.Textarea,
|
||||||
'startdate': DateInput(),
|
'startdate': AdminDateWidget(),
|
||||||
'enddate': DateInput(),
|
'enddate': AdminDateWidget(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1163,7 +1164,7 @@ class WorkoutForm(ModelForm):
|
|||||||
model = Workout
|
model = Workout
|
||||||
fields = ['name','date','starttime','timezone','duration','distance','workouttype','notes','privacy','rankingpiece','boattype']
|
fields = ['name','date','starttime','timezone','duration','distance','workouttype','notes','privacy','rankingpiece','boattype']
|
||||||
widgets = {
|
widgets = {
|
||||||
'date': DateInput(),
|
'date': AdminDateWidget(),
|
||||||
'notes': forms.Textarea,
|
'notes': forms.Textarea,
|
||||||
'duration': forms.TimeInput(format='%H:%M:%S.%f'),
|
'duration': forms.TimeInput(format='%H:%M:%S.%f'),
|
||||||
}
|
}
|
||||||
|
|||||||
+26
-13
@@ -79,13 +79,16 @@ def get_session_metrics(ps):
|
|||||||
distance = []
|
distance = []
|
||||||
firstname = []
|
firstname = []
|
||||||
lastname = []
|
lastname = []
|
||||||
|
completedate = []
|
||||||
|
status = []
|
||||||
|
|
||||||
for r in rowers:
|
for r in rowers:
|
||||||
rscorev = 0
|
rscorev = 0
|
||||||
trimpv = 0
|
trimpv = 0
|
||||||
durationv = 0
|
durationv = 0
|
||||||
distancev = 0
|
distancev = 0
|
||||||
|
completedatev = ''
|
||||||
|
statusv = 0
|
||||||
|
|
||||||
ws = Workout.objects.filter(user=r,plannedsession=ps)
|
ws = Workout.objects.filter(user=r,plannedsession=ps)
|
||||||
if len(ws) != 0:
|
if len(ws) != 0:
|
||||||
@@ -93,9 +96,10 @@ def get_session_metrics(ps):
|
|||||||
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)
|
trimpv += dataprep.workout_trimp(w)
|
||||||
rscorev += dataprep.workout_rscore(w)
|
rscorev += dataprep.workout_rscore(w)[0]
|
||||||
|
|
||||||
|
|
||||||
|
ratio,statusv = is_session_complete_ws(ws,ps)
|
||||||
|
completedatev = ws[0].date.strftime('%Y-%b-%d')
|
||||||
durationv /= 60.
|
durationv /= 60.
|
||||||
|
|
||||||
trimp.append(int(trimpv))
|
trimp.append(int(trimpv))
|
||||||
@@ -104,6 +108,8 @@ def get_session_metrics(ps):
|
|||||||
rscore.append(int(rscorev))
|
rscore.append(int(rscorev))
|
||||||
firstname.append(r.user.first_name)
|
firstname.append(r.user.first_name)
|
||||||
lastname.append(r.user.last_name)
|
lastname.append(r.user.last_name)
|
||||||
|
status.append(statusv)
|
||||||
|
completedate.append(completedatev)
|
||||||
|
|
||||||
thedict = {
|
thedict = {
|
||||||
'first_name':firstname,
|
'first_name':firstname,
|
||||||
@@ -111,19 +117,14 @@ def get_session_metrics(ps):
|
|||||||
'duration':duration,
|
'duration':duration,
|
||||||
'distance':distance,
|
'distance':distance,
|
||||||
'rscore':rscore,
|
'rscore':rscore,
|
||||||
'trimp':trimp
|
'trimp':trimp,
|
||||||
|
'completedate':completedate,
|
||||||
|
'status':status,
|
||||||
}
|
}
|
||||||
|
|
||||||
return thedict
|
return thedict
|
||||||
|
|
||||||
def is_session_complete(r,ps):
|
def is_session_complete_ws(ws,ps):
|
||||||
status = 'not done'
|
|
||||||
|
|
||||||
if r not in ps.rower.all():
|
|
||||||
return 0,'not assigned'
|
|
||||||
|
|
||||||
ws = Workout.objects.filter(user=r,plannedsession=ps)
|
|
||||||
|
|
||||||
if len(ws)==0:
|
if len(ws)==0:
|
||||||
today = date.today()
|
today = date.today()
|
||||||
if today > ps.enddate:
|
if today > ps.enddate:
|
||||||
@@ -144,7 +145,7 @@ def is_session_complete(r,ps):
|
|||||||
trimp = dataprep.workout_trimp(w)
|
trimp = dataprep.workout_trimp(w)
|
||||||
score += trimp
|
score += trimp
|
||||||
elif ps.sessionmode == 'rScore':
|
elif ps.sessionmode == 'rScore':
|
||||||
rscore = dataprep.workout_rscore(w)
|
rscore = dataprep.workout_rscore(w)[0]
|
||||||
score += rscore
|
score += rscore
|
||||||
|
|
||||||
value = ps.sessionvalue
|
value = ps.sessionvalue
|
||||||
@@ -195,6 +196,18 @@ def is_session_complete(r,ps):
|
|||||||
else:
|
else:
|
||||||
return ratio,status
|
return ratio,status
|
||||||
|
|
||||||
|
|
||||||
|
def is_session_complete(r,ps):
|
||||||
|
status = 'not done'
|
||||||
|
|
||||||
|
if r not in ps.rower.all():
|
||||||
|
return 0,'not assigned'
|
||||||
|
|
||||||
|
ws = Workout.objects.filter(user=r,plannedsession=ps)
|
||||||
|
|
||||||
|
return is_session_complete_ws(ws,ps)
|
||||||
|
|
||||||
|
|
||||||
def rank_results(ps):
|
def rank_results(ps):
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|||||||
@@ -125,3 +125,47 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block scripts %}
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function(){
|
||||||
|
$("td #id_sessionmode").change(function() {
|
||||||
|
|
||||||
|
if (this.value == 'TRIMP') {
|
||||||
|
$("td #id_sessionunit").prop("value","None");
|
||||||
|
}
|
||||||
|
if (this.value == 'distance') {
|
||||||
|
$("td #id_sessionunit").prop("value","m");
|
||||||
|
}
|
||||||
|
if (this.value == 'time') {
|
||||||
|
$("td #id_sessionunit").prop("value","min");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.value == 'rScore') {
|
||||||
|
$("td #id_sessionunit").prop("value","None");
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$("td #id_sessiontype").change(function() {
|
||||||
|
|
||||||
|
if (this.value == 'session') {
|
||||||
|
$("td #id_criterium").prop("value","none");
|
||||||
|
}
|
||||||
|
if (this.value == 'test') {
|
||||||
|
$("td #id_criterium").prop("value","exact");
|
||||||
|
}
|
||||||
|
if (this.value == 'challenge') {
|
||||||
|
$("td #id_criterium").prop("value","minimum");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="grid_12 alpha">
|
<div class="grid_12 alpha">
|
||||||
<div id="left" class="grid_6 alpha">
|
<div id="left" class="grid_6 alpha">
|
||||||
<h1>Edit Session {{ thesession.name }}</h1>
|
<h1>Edit Session</h1>
|
||||||
</div>
|
</div>
|
||||||
<div id="timeperiod" class="grid_2 dropdown">
|
<div id="timeperiod" class="grid_2 dropdown">
|
||||||
<button class="grid_2 alpha button gray small dropbtn">Select Time Period ({{ timeperiod|verbosetimeperiod }})</button>
|
<button class="grid_2 alpha button gray small dropbtn">Select Time Period ({{ timeperiod|verbosetimeperiod }})</button>
|
||||||
@@ -47,29 +47,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_12 alpha">
|
<div class="grid_12 alpha">
|
||||||
<div class="grid_6 alpha">
|
<div id="right" class="grid_6 alpha">
|
||||||
<form enctype="multipart/form-data" action="{{ formloc }}" method="post">
|
|
||||||
{% if form.errors %}
|
|
||||||
<p style="color: red;">
|
|
||||||
Please correct the error{{ form.errors|pluralize }} below.
|
|
||||||
</p>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<table>
|
|
||||||
{{ form.as_table }}
|
|
||||||
</table>
|
|
||||||
{% csrf_token %}
|
|
||||||
<div class="grid_1 prefix_2 alpha">
|
|
||||||
<a class="red button small" href="/rowers/sessions/{{ thesession.id }}/deleteconfirm">Delete</a>
|
|
||||||
</div>
|
|
||||||
<div class="grid_1">
|
|
||||||
<a class="gray button small" href="/rowers/sessions/{{ thesession.id }}/clone">Clone</a>
|
|
||||||
</div>
|
|
||||||
<div id="formbutton" class="grid_1 suffix_1 omega">
|
|
||||||
<input class="button green" type="submit" value="Save">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="right" class="grid_6 omega">
|
|
||||||
<h1>Plan</h1>
|
<h1>Plan</h1>
|
||||||
<p>
|
<p>
|
||||||
Click on session name to view
|
Click on session name to view
|
||||||
@@ -124,8 +102,76 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="grid_6 omega">
|
||||||
|
<h1>{{ thesession.name }}</h1>
|
||||||
|
<form enctype="multipart/form-data" action="{{ formloc }}" method="post">
|
||||||
|
{% if form.errors %}
|
||||||
|
<p style="color: red;">
|
||||||
|
Please correct the error{{ form.errors|pluralize }} below.
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<table>
|
||||||
|
{{ form.as_table }}
|
||||||
|
</table>
|
||||||
|
{% csrf_token %}
|
||||||
|
<div class="grid_1 prefix_2 alpha">
|
||||||
|
<a class="red button small" href="/rowers/sessions/{{ thesession.id }}/deleteconfirm">Delete</a>
|
||||||
|
</div>
|
||||||
|
<div class="grid_1">
|
||||||
|
<a class="gray button small" href="/rowers/sessions/{{ thesession.id }}/clone">Clone</a>
|
||||||
|
</div>
|
||||||
|
<div id="formbutton" class="grid_1 suffix_1 omega">
|
||||||
|
<input class="button green" type="submit" value="Save">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block scripts %}
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function(){
|
||||||
|
$("td #id_sessionmode").change(function() {
|
||||||
|
|
||||||
|
if (this.value == 'TRIMP') {
|
||||||
|
$("td #id_sessionunit").prop("value","None");
|
||||||
|
}
|
||||||
|
if (this.value == 'distance') {
|
||||||
|
$("td #id_sessionunit").prop("value","m");
|
||||||
|
}
|
||||||
|
if (this.value == 'time') {
|
||||||
|
$("td #id_sessionunit").prop("value","min");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.value == 'rScore') {
|
||||||
|
$("td #id_sessionunit").prop("value","None");
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$("td #id_sessiontype").change(function() {
|
||||||
|
|
||||||
|
if (this.value == 'session') {
|
||||||
|
$("td #id_criterium").prop("value","none");
|
||||||
|
}
|
||||||
|
if (this.value == 'test') {
|
||||||
|
$("td #id_criterium").prop("value","exact");
|
||||||
|
}
|
||||||
|
if (this.value == 'challenge') {
|
||||||
|
$("td #id_criterium").prop("value","minimum");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
|
|||||||
@@ -63,6 +63,7 @@
|
|||||||
<th>On or Before</th>
|
<th>On or Before</th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Type</th>
|
<th>Type</th>
|
||||||
|
<th>Mode</th>
|
||||||
<th>Edit</th>
|
<th>Edit</th>
|
||||||
<th>Planned</th>
|
<th>Planned</th>
|
||||||
<th>Actual</th>
|
<th>Actual</th>
|
||||||
@@ -96,7 +97,8 @@
|
|||||||
href="/rowers/sessions/{{ ps.id }}">Unnamed Session</a>
|
href="/rowers/sessions/{{ ps.id }}">Unnamed Session</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td> {{ ps.sessiontype }} </td>
|
<td> {{ ps.get_sessiontype_display }} </td>
|
||||||
|
<td> {{ ps.get_sessionmode_display }} </td>
|
||||||
<td>
|
<td>
|
||||||
{% if ps.manager == request.user %}
|
{% if ps.manager == request.user %}
|
||||||
<a class="small"
|
<a class="small"
|
||||||
|
|||||||
@@ -99,10 +99,10 @@
|
|||||||
<td>
|
<td>
|
||||||
{% if thedict|lookup:'results'|lookup:r.id == 'completed' %}
|
{% if thedict|lookup:'results'|lookup:r.id == 'completed' %}
|
||||||
<a class="green dot"
|
<a class="green dot"
|
||||||
href="/rowers/sessions/manage/{{ timeperiod }}/rower/{{ r.id }}/session/{{ key }}"> </a>
|
href="{% url 'plannedsession_view' id=key rowerid=r.id %}"> </a>
|
||||||
{% elif thedict|lookup:'results'|lookup:r.id == 'partial' %}
|
{% elif thedict|lookup:'results'|lookup:r.id == 'partial' %}
|
||||||
<a class="orange dot"
|
<a class="orange dot"
|
||||||
href="/rowers/sessions/manage/{{ timeperiod }}/rower/{{ r.id }}/session/{{ key }}"> </a>
|
href="{% url 'plannedsession_view' id=key rowerid=r.id %}"> </a>
|
||||||
{% elif thedict|lookup:'results'|lookup:r.id == 'not done' %}
|
{% elif thedict|lookup:'results'|lookup:r.id == 'not done' %}
|
||||||
<a class="white dot"
|
<a class="white dot"
|
||||||
href="/rowers/sessions/manage/{{ timeperiod }}/rower/{{ r.id }}/session/{{ key }}"> </a>
|
href="/rowers/sessions/manage/{{ timeperiod }}/rower/{{ r.id }}/session/{{ key }}"> </a>
|
||||||
|
|||||||
@@ -2,9 +2,13 @@
|
|||||||
{% load staticfiles %}
|
{% load staticfiles %}
|
||||||
{% load rowerfilters %}
|
{% load rowerfilters %}
|
||||||
|
|
||||||
|
{% block meta %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block title %}Planned Session{% endblock %}
|
{% block title %}Planned Session{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
<div class="grid_12 alpha">
|
<div class="grid_12 alpha">
|
||||||
{% include "planningbuttons.html" %}
|
{% include "planningbuttons.html" %}
|
||||||
|
|
||||||
@@ -64,13 +68,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="grid_12 alpha">
|
<div class="grid_12 alpha">
|
||||||
<div id="left" class="grid_6 alpha">
|
<div id="left" class="grid_6 alpha">
|
||||||
<h1>Result</h1>
|
<h1>{{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
|
||||||
<p>Status: {{ status }}</p>
|
<p>Status: {{ status }}</p>
|
||||||
<p>Percentage complete: {{ ratio }} </p>
|
<p>Percentage complete: {{ ratio }} </p>
|
||||||
</div>
|
</div>
|
||||||
<div id="right" class="grid_6 omega">
|
<div id="right" class="grid_6 omega">
|
||||||
<h1>Stats</h1>
|
<h1>Stats</h1>
|
||||||
<table class="listtable shortpadded" width="80%">
|
<table class="listtable shortpadded" width="100%">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
@@ -78,6 +82,8 @@
|
|||||||
<th>Meters</th>
|
<th>Meters</th>
|
||||||
<th>rScore</th>
|
<th>rScore</th>
|
||||||
<th>TRIMP</th>
|
<th>TRIMP</th>
|
||||||
|
<th>Complete Date</th>
|
||||||
|
<th>Status</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -88,6 +94,8 @@
|
|||||||
<td>{{ value|lookup:'distance' }}</td>
|
<td>{{ value|lookup:'distance' }}</td>
|
||||||
<td>{{ value|lookup:'rscore' }}</td>
|
<td>{{ value|lookup:'rscore' }}</td>
|
||||||
<td>{{ value|lookup:'trimp' }}</td>
|
<td>{{ value|lookup:'trimp' }}</td>
|
||||||
|
<td>{{ value|lookup:'completedate' }}</td>
|
||||||
|
<td>{{ value|lookup:'status' }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -95,4 +103,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block scripts %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block title %}Contact Us{% endblock title %}
|
{% block title %}Contact Us{% endblock title %}
|
||||||
|
{% block meta %}
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div id="registrationform" class="grid_6 alpha">
|
<div id="registrationform" class="grid_6 alpha">
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -427,7 +427,10 @@ urlpatterns = [
|
|||||||
url(r'^sessions/(?P<id>\d+)/clone/(?P<timeperiod>[\w\ ]+.*)/rower/(?P<rowerid>\d+)$',views.plannedsession_clone_view),
|
url(r'^sessions/(?P<id>\d+)/clone/(?P<timeperiod>[\w\ ]+.*)/rower/(?P<rowerid>\d+)$',views.plannedsession_clone_view),
|
||||||
url(r'^sessions/(?P<id>\d+)/clone/(?P<timeperiod>[\w\ ]+.*)$',views.plannedsession_clone_view),
|
url(r'^sessions/(?P<id>\d+)/clone/(?P<timeperiod>[\w\ ]+.*)$',views.plannedsession_clone_view),
|
||||||
|
|
||||||
url(r'^sessions/(?P<id>\d+)$',views.plannedsession_view),
|
url(r'^sessions/(?P<id>\d+)$',views.plannedsession_view,
|
||||||
|
name='plannedsession_view'),
|
||||||
|
url(r'^sessions/(?P<id>\d+)/rower/(?P<rowerid>\d+)$',views.plannedsession_view,
|
||||||
|
name='plannedsession_view'),
|
||||||
url(r'^sessions/(?P<id>\d+)/deleteconfirm$',views.plannedsession_deleteconfirm_view),
|
url(r'^sessions/(?P<id>\d+)/deleteconfirm$',views.plannedsession_deleteconfirm_view),
|
||||||
url(r'^sessions/(?P<id>\d+)/delete$',views.plannedsession_delete_view),
|
url(r'^sessions/(?P<id>\d+)/delete$',views.plannedsession_delete_view),
|
||||||
url(r'^sessions/manage/session/(?P<initialsession>\d+)$',
|
url(r'^sessions/manage/session/(?P<initialsession>\d+)$',
|
||||||
|
|||||||
+19
-6
@@ -296,12 +296,25 @@ def my_dict_from_instance(instance,model):
|
|||||||
thedict = {}
|
thedict = {}
|
||||||
thedict['id'] = instance.id
|
thedict['id'] = instance.id
|
||||||
|
|
||||||
for attr, value in instance.__dict__.iteritems():
|
for f in instance._meta.fields:
|
||||||
try:
|
|
||||||
verbose_name = model._meta.get_field(attr).verbose_name
|
|
||||||
except:
|
|
||||||
verbose_name = attr
|
|
||||||
|
|
||||||
thedict[attr] = (verbose_name,value)
|
fname = f.name
|
||||||
|
|
||||||
|
try:
|
||||||
|
verbosename = f.verbose_name
|
||||||
|
except:
|
||||||
|
verbosename = f.name
|
||||||
|
|
||||||
|
get_choice = 'get_'+fname+'_display'
|
||||||
|
if hasattr( instance, get_choice):
|
||||||
|
value = getattr(instance, get_choice)()
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
value = getattr(instance,fname)
|
||||||
|
except AttributeError:
|
||||||
|
value = None
|
||||||
|
|
||||||
|
if f.editable and value:
|
||||||
|
thedict[fname] = (verbosename,value)
|
||||||
|
|
||||||
return thedict
|
return thedict
|
||||||
|
|||||||
+22
-16
@@ -7468,19 +7468,10 @@ def workout_stats_view(request,id=0,message="",successmessage=""):
|
|||||||
otherstats = {}
|
otherstats = {}
|
||||||
|
|
||||||
# Normalized power & TSS
|
# Normalized power & TSS
|
||||||
duration = datadf['time'].max()-datadf['time'].min()
|
tss,normp = dataprep.workout_rscore(w)
|
||||||
duration /= 1.0e3
|
|
||||||
pwr4 = datadf['power']**(4.0)
|
|
||||||
normp = (pwr4.mean())**(0.25)
|
|
||||||
if not np.isnan(normp):
|
|
||||||
ftp = float(r.ftp)
|
|
||||||
if w.workouttype in ('water','coastal'):
|
|
||||||
ftp = ftp*(100.-r.otwslack)/100.
|
|
||||||
|
|
||||||
intensityfactor = normp/float(ftp)
|
|
||||||
tss = 100.*((duration*normp*intensityfactor)/(3600.*ftp))
|
|
||||||
|
|
||||||
if not np.isnan(tss):
|
if not np.isnan(tss) and tss != 0:
|
||||||
otherstats['tss'] = {
|
otherstats['tss'] = {
|
||||||
'verbose_name':'rScore',
|
'verbose_name':'rScore',
|
||||||
'value':int(tss),
|
'value':int(tss),
|
||||||
@@ -7521,9 +7512,8 @@ def workout_stats_view(request,id=0,message="",successmessage=""):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
# TRIMP
|
# TRIMP
|
||||||
if datadf['hr'].mean() > 0 and r.sex != 'not specified':
|
trimp = dataprep.workout_trimp(w)
|
||||||
trimp = metrics.calc_trimp(datadf,r.sex,r.max,r.rest)
|
|
||||||
trimp = int(trimp)
|
|
||||||
otherstats['trimp'] = {
|
otherstats['trimp'] = {
|
||||||
'verbose_name': 'TRIMP',
|
'verbose_name': 'TRIMP',
|
||||||
'value': trimp,
|
'value': trimp,
|
||||||
@@ -11632,6 +11622,9 @@ def plannedsession_create_view(request,timeperiod='thisweek',rowerid=0):
|
|||||||
|
|
||||||
add_rower_session(r,ps)
|
add_rower_session(r,ps)
|
||||||
|
|
||||||
|
request.session['fstartdate'] = str(arrow.get(startdate))
|
||||||
|
request.session['fenddate'] = str(arrow.get(enddate))
|
||||||
|
|
||||||
url = reverse(plannedsession_create_view,
|
url = reverse(plannedsession_create_view,
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'rowerid':r.id,
|
'rowerid':r.id,
|
||||||
@@ -11639,7 +11632,20 @@ def plannedsession_create_view(request,timeperiod='thisweek',rowerid=0):
|
|||||||
})
|
})
|
||||||
return HttpResponseRedirect(url)
|
return HttpResponseRedirect(url)
|
||||||
else:
|
else:
|
||||||
sessioncreateform = PlannedSessionForm()
|
if 'fstartdate' in request.session:
|
||||||
|
fstartdate = arrow.get(request.session['fstartdate']).date()
|
||||||
|
fenddate = arrow.get(request.session['fenddate']).date()
|
||||||
|
|
||||||
|
forminitial = {
|
||||||
|
'startdate':fstartdate,
|
||||||
|
'enddate':fenddate
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
forminitial = {}
|
||||||
|
|
||||||
|
print forminitial
|
||||||
|
|
||||||
|
sessioncreateform = PlannedSessionForm(initial=forminitial)
|
||||||
|
|
||||||
startdate,enddate = get_dates_timeperiod(timeperiod)
|
startdate,enddate = get_dates_timeperiod(timeperiod)
|
||||||
sps = get_sessions(r,startdate=startdate,enddate=enddate)
|
sps = get_sessions(r,startdate=startdate,enddate=enddate)
|
||||||
@@ -12243,7 +12249,6 @@ def plannedsession_view(request,id=0,rowerid=0):
|
|||||||
resultsdict = pd.DataFrame(resultsdict).transpose().to_dict()
|
resultsdict = pd.DataFrame(resultsdict).transpose().to_dict()
|
||||||
|
|
||||||
psdict = my_dict_from_instance(ps,PlannedSession)
|
psdict = my_dict_from_instance(ps,PlannedSession)
|
||||||
print psdict
|
|
||||||
|
|
||||||
ws = get_workouts_session(r,ps)
|
ws = get_workouts_session(r,ps)
|
||||||
|
|
||||||
@@ -12256,6 +12261,7 @@ def plannedsession_view(request,id=0,rowerid=0):
|
|||||||
'psdict': psdict,
|
'psdict': psdict,
|
||||||
'attrs':[
|
'attrs':[
|
||||||
'name','startdate','enddate','sessiontype',
|
'name','startdate','enddate','sessiontype',
|
||||||
|
'sessionmode',
|
||||||
'sessionvalue','sessionunit'
|
'sessionvalue','sessionunit'
|
||||||
],
|
],
|
||||||
'workouts': ws,
|
'workouts': ws,
|
||||||
|
|||||||
Vendored
+2
File diff suppressed because one or more lines are too long
@@ -13,10 +13,9 @@
|
|||||||
|
|
||||||
<script type="text/javascript" src="/admin/jsi18n/"></script>
|
<script type="text/javascript" src="/admin/jsi18n/"></script>
|
||||||
<script type="text/javascript" src="/static/admin/js/core.js"></script>
|
<script type="text/javascript" src="/static/admin/js/core.js"></script>
|
||||||
<script type="text/javascript" src="/static/admin/js/admin/RelatedObjectLookups.js"> </script>
|
|
||||||
<script type="text/javascript" src="/static/admin/js/jquery.min.js"></script>
|
<script type="text/javascript" src="/static/admin/js/jquery.min.js"></script>
|
||||||
<script type="text/javascript" src="/static/admin/js/jquery.init.js"></script>
|
<script type="text/javascript" src="/static/admin/js/jquery.init.js"></script>
|
||||||
<script type="text/javascript" src="/static/admin/js/actions.min.js"></script>
|
<script type="text/javascript" src="/static/admin/js/admin/RelatedObjectLookups.js"> </script>
|
||||||
<script type="text/javascript" src="/static/admin/js/calendar.js"></script>
|
<script type="text/javascript" src="/static/admin/js/calendar.js"></script>
|
||||||
<script type="text/javascript" src="/static/admin/js/urlify.js"></script>
|
<script type="text/javascript" src="/static/admin/js/urlify.js"></script>
|
||||||
<script type="text/javascript" src="/static/admin/js/prepopulate.js"></script>
|
<script type="text/javascript" src="/static/admin/js/prepopulate.js"></script>
|
||||||
|
|||||||
Reference in New Issue
Block a user