Merge branch 'release/v8.38'
This commit is contained in:
+10
-2
@@ -945,6 +945,7 @@ class TrainingTarget(models.Model):
|
|||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
date = self.date
|
date = self.date
|
||||||
name = self.name
|
name = self.name
|
||||||
|
id = self.pk
|
||||||
try:
|
try:
|
||||||
ownerfirst = self.manager.user.first_name
|
ownerfirst = self.manager.user.first_name
|
||||||
ownerlast = self.manager.user.last_name
|
ownerlast = self.manager.user.last_name
|
||||||
@@ -952,11 +953,12 @@ class TrainingTarget(models.Model):
|
|||||||
ownerfirst = ''
|
ownerfirst = ''
|
||||||
ownerlast = ''
|
ownerlast = ''
|
||||||
|
|
||||||
stri = u'{ownerfirst} {ownerlast} {d} {n}'.format(
|
stri = u'#{id}: {n} {d} {ownerfirst} {ownerlast}'.format(
|
||||||
ownerfirst = ownerfirst,
|
ownerfirst = ownerfirst,
|
||||||
ownerlast = ownerlast,
|
ownerlast = ownerlast,
|
||||||
d = date.strftime('%Y-%m-%d'),
|
d = date.strftime('%Y-%m-%d'),
|
||||||
n = name
|
n = name,
|
||||||
|
id = id,
|
||||||
)
|
)
|
||||||
|
|
||||||
return stri
|
return stri
|
||||||
@@ -1099,6 +1101,12 @@ class TrainingPlanForm(ModelForm):
|
|||||||
targetchoices = [(x.id,x) for x in targets]
|
targetchoices = [(x.id,x) for x in targets]
|
||||||
targetchoices.append((None,'---'))
|
targetchoices.append((None,'---'))
|
||||||
self.fields['target'].choices = targetchoices
|
self.fields['target'].choices = targetchoices
|
||||||
|
elif self.instance.pk is not None:
|
||||||
|
self.fields['target'].queryset = TrainingTarget.objects.filter(
|
||||||
|
manager=self.instance.manager,
|
||||||
|
date__gte=datetime.date.today()).order_by("date")
|
||||||
|
else:
|
||||||
|
self.fields.pop('target')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
teams = Team.objects.filter(manager=self.instance.manager.user)
|
teams = Team.objects.filter(manager=self.instance.manager.user)
|
||||||
|
|||||||
+17
-5
@@ -580,19 +580,31 @@ def handle_calctrimp(id,
|
|||||||
df = rowdata.df
|
df = rowdata.df
|
||||||
|
|
||||||
df['deltat'] = df[' ElapsedTime (sec)'].diff().abs()
|
df['deltat'] = df[' ElapsedTime (sec)'].diff().abs()
|
||||||
|
|
||||||
|
df2 = df.copy()
|
||||||
|
|
||||||
|
df2['time'] = df2[' ElapsedTime (sec)']
|
||||||
|
df2['time'] = df2['time'].apply(
|
||||||
|
lambda x:timedelta(seconds=x)
|
||||||
|
)
|
||||||
|
|
||||||
duration = df['TimeStamp (sec)'].max()-df['TimeStamp (sec)'].min()
|
duration = df['TimeStamp (sec)'].max()-df['TimeStamp (sec)'].min()
|
||||||
|
df2 = df2.resample('1s',on='time').mean()
|
||||||
|
df2.fillna(method='ffill',inplace=True)
|
||||||
|
df2 = df2.rolling(30).mean()
|
||||||
|
|
||||||
df[' Power (watts)'] = df[' Power (watts)'].abs()
|
df2[' Power (watts)'] = df2[' Power (watts)'].abs()
|
||||||
|
|
||||||
df['pwr4'] = df[' Power (watts)']**(4.0)
|
df2['pwr4'] = df2[' Power (watts)']**(4.0)
|
||||||
pwr4mean = wavg(df,'pwr4','deltat')
|
# pwr4mean = wavg(df,'pwr4','deltat')
|
||||||
pwrmean = wavg(df,' Power (watts)','deltat')
|
pwr4mean = df2['pwr4'].mean()
|
||||||
|
pwrmean = df2[' Power (watts)'].mean()
|
||||||
|
# pwrmean = wavg(df,' Power (watts)','deltat')
|
||||||
if pwr4mean > 0:
|
if pwr4mean > 0:
|
||||||
normp = (pwr4mean)**(0.25)
|
normp = (pwr4mean)**(0.25)
|
||||||
else:
|
else:
|
||||||
normp = pwrmean
|
normp = pwrmean
|
||||||
|
|
||||||
intensityfactor = pwrmean/float(ftp)
|
|
||||||
intensityfactor = normp/float(ftp)
|
intensityfactor = normp/float(ftp)
|
||||||
tss = 100.*((duration*normp*intensityfactor)/(3600.*ftp))
|
tss = 100.*((duration*normp*intensityfactor)/(3600.*ftp))
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,13 @@
|
|||||||
{{ macrocycle.0.name }} ({{ macrocycle.0.startdate }} - {{ macrocycle.0.enddate }})
|
{{ macrocycle.0.name }} ({{ macrocycle.0.startdate }} - {{ macrocycle.0.enddate }})
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
{% if macrocycle.0.notes %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="4">
|
||||||
|
{{ macrocycle.0.notes|linebreaks }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
{% if macrocycle.0.type == 'userdefined' and macrocycle.0.plan.status %}
|
{% if macrocycle.0.type == 'userdefined' and macrocycle.0.plan.status %}
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
@@ -180,6 +187,13 @@
|
|||||||
Meso {{ mesocycle.0.name }} ({{ mesocycle.0.startdate }} - {{ mesocycle.0.enddate }})
|
Meso {{ mesocycle.0.name }} ({{ mesocycle.0.startdate }} - {{ mesocycle.0.enddate }})
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
{% if mesocycle.0.notes %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="4">
|
||||||
|
{{ mesocycle.0.notes|linebreaks }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
{% if mesocycle.0.type == 'userdefined' and mesocycle.0.plan.plan.status %}
|
{% if mesocycle.0.type == 'userdefined' and mesocycle.0.plan.plan.status %}
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
@@ -299,6 +313,13 @@
|
|||||||
Micro {{ microcycle.name }} ({{ microcycle.startdate }} - {{ microcycle.enddate }})
|
Micro {{ microcycle.name }} ({{ microcycle.startdate }} - {{ microcycle.enddate }})
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
{% if microcycle.notes %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="4">
|
||||||
|
{{ microcycle.notes|linebreaks }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
{% if microcycle.plan.plan.plan.status %}
|
{% if microcycle.plan.plan.plan.status %}
|
||||||
<tr>
|
<tr>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
|||||||
@@ -397,9 +397,12 @@ def timeurl(path,timestring):
|
|||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
def trainingplans(rower):
|
def trainingplans(rower):
|
||||||
|
today = datetime.date.today()
|
||||||
plans = TrainingPlan.objects.filter(
|
plans = TrainingPlan.objects.filter(
|
||||||
rowers=rower,
|
rowers=rower,
|
||||||
status=True).order_by("-startdate")
|
status=True,
|
||||||
|
startdate__lte=today,
|
||||||
|
enddate__gte=today).order_by("-startdate")
|
||||||
|
|
||||||
return plans
|
return plans
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -170,7 +170,7 @@ urlpatterns = [
|
|||||||
url(r'^team-compare-select/workout/(?P<id>\d+)/user/(?P<userid>\d+)/$',views.team_comparison_select),
|
url(r'^team-compare-select/workout/(?P<id>\d+)/user/(?P<userid>\d+)/$',views.team_comparison_select),
|
||||||
url(r'^team-compare-select/team/(?P<teamid>\d+)/user/(?P<userid>\d+)/$',views.team_comparison_select),
|
url(r'^team-compare-select/team/(?P<teamid>\d+)/user/(?P<userid>\d+)/$',views.team_comparison_select),
|
||||||
url(r'^team-compare-select/workout/(?P<id>\d+)/$',views.team_comparison_select),
|
url(r'^team-compare-select/workout/(?P<id>\d+)/$',views.team_comparison_select),
|
||||||
url(r'^team-compare-select/team/(?P<teamid>\d+)$',views.team_comparison_select),
|
url(r'^team-compare-select/team/(?P<teamid>\d+)/$',views.team_comparison_select),
|
||||||
url(r'^team-compare-select/$',views.team_comparison_select),
|
url(r'^team-compare-select/$',views.team_comparison_select),
|
||||||
url(r'^workouts-join-select/team/(?P<teamid>\d+)/(?P<startdatestring>\d+-\d+-\d+)/(?P<enddatestring>\d+-\d+-\d+)$',views.workouts_join_select),
|
url(r'^workouts-join-select/team/(?P<teamid>\d+)/(?P<startdatestring>\d+-\d+-\d+)/(?P<enddatestring>\d+-\d+-\d+)$',views.workouts_join_select),
|
||||||
url(r'^workouts-join$',views.workouts_join_view),
|
url(r'^workouts-join$',views.workouts_join_view),
|
||||||
|
|||||||
+6
-1
@@ -16188,7 +16188,10 @@ def rower_create_trainingplan(request,userid=0):
|
|||||||
p.rowers.add(therower)
|
p.rowers.add(therower)
|
||||||
|
|
||||||
|
|
||||||
targets = TrainingTarget.objects.filter(rowers=therower).order_by("date")
|
targets = TrainingTarget.objects.filter(
|
||||||
|
rowers=therower,
|
||||||
|
date__gte=datetime.date.today(),
|
||||||
|
).order_by("date")
|
||||||
targetform = TrainingTargetForm()
|
targetform = TrainingTargetForm()
|
||||||
|
|
||||||
plans = TrainingPlan.objects.filter(rowers=therower).order_by("-startdate")
|
plans = TrainingPlan.objects.filter(rowers=therower).order_by("-startdate")
|
||||||
@@ -17008,6 +17011,8 @@ class TrainingPlanUpdate(UpdateView):
|
|||||||
obj = super(TrainingPlanUpdate, self).get_object(*args, **kwargs)
|
obj = super(TrainingPlanUpdate, self).get_object(*args, **kwargs)
|
||||||
if obj.manager is not None and self.request.user.rower != obj.manager:
|
if obj.manager is not None and self.request.user.rower != obj.manager:
|
||||||
raise PermissionDenied('You are not allowed to edit this training plan cycle')
|
raise PermissionDenied('You are not allowed to edit this training plan cycle')
|
||||||
|
if obj.manager.rowerplan not in ['coach','plan']:
|
||||||
|
raise PermissionDenied('You are not allowed to edit this training plan')
|
||||||
|
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user