first version wup cd
This commit is contained in:
@@ -1271,6 +1271,8 @@ class Rower(models.Model):
|
|||||||
imports_are_private = models.BooleanField(default=False, verbose_name='Make imports private by default')
|
imports_are_private = models.BooleanField(default=False, verbose_name='Make imports private by default')
|
||||||
show_commutes = models.BooleanField(default=False, verbose_name='Show commutes in workout list')
|
show_commutes = models.BooleanField(default=False, verbose_name='Show commutes in workout list')
|
||||||
small_commutes = models.BooleanField(default=False, verbose_name='Show commutes on a single line in workout list')
|
small_commutes = models.BooleanField(default=False, verbose_name='Show commutes on a single line in workout list')
|
||||||
|
show_wups_cds = models.BooleanField(default=False, verbose_name='Show warmups and cooldowns in workout list')
|
||||||
|
small_wups_cds = models.BooleanField(default=False, verbose_name='Show warmups and cooldowns on a single line in workout list')
|
||||||
|
|
||||||
# Friends/Team
|
# Friends/Team
|
||||||
friends = models.ManyToManyField("self", blank=True)
|
friends = models.ManyToManyField("self", blank=True)
|
||||||
@@ -5217,6 +5219,8 @@ class AccountRowerForm(ModelForm):
|
|||||||
'defaultlandingpage3',
|
'defaultlandingpage3',
|
||||||
'show_commutes',
|
'show_commutes',
|
||||||
'small_commutes',
|
'small_commutes',
|
||||||
|
'show_wups_cds',
|
||||||
|
'small_wups_cds',
|
||||||
'offercoaching', 'autojoin', 'emailalternatives']
|
'offercoaching', 'autojoin', 'emailalternatives']
|
||||||
|
|
||||||
widgets = {
|
widgets = {
|
||||||
|
|||||||
@@ -34,12 +34,18 @@
|
|||||||
</h1>
|
</h1>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if nr_commutes %}
|
{% if nr_commutes or nr_wups_cds %}
|
||||||
<p>
|
<p>
|
||||||
<a href="?show_commutes=true">Show {{ nr_commutes }} commutes</a>
|
{% if nr_commutes %}
|
||||||
|
<a href="?show_commutes=true">Show {{ nr_commutes }} commutes</a>
|
||||||
|
{% endif %}
|
||||||
|
{% if nr_wups_cds %}
|
||||||
|
<a href="?show_wups_cds=true">Show {{ nr_wups_cds }} warmups and cooldowns</a>
|
||||||
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
<ul class="main-content">
|
<ul class="main-content">
|
||||||
<li class="grid_4">
|
<li class="grid_4">
|
||||||
<span>
|
<span>
|
||||||
@@ -109,7 +115,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% for workout in workouts %}
|
{% for workout in workouts %}
|
||||||
{% if not workout.is_commute or not user.rower.small_commutes %}
|
{% if workout|show_normal %}
|
||||||
<li class="grid_4 divlines">
|
<li class="grid_4 divlines">
|
||||||
{% if request.GET.selectworkouts %}
|
{% if request.GET.selectworkouts %}
|
||||||
<input type="checkbox" id="workoutid" value={{ workout.id|encode }} name="workoutid" />
|
<input type="checkbox" id="workoutid" value={{ workout.id|encode }} name="workoutid" />
|
||||||
@@ -124,6 +130,14 @@
|
|||||||
{% if workout.rankingpiece %}
|
{% if workout.rankingpiece %}
|
||||||
<span style="font-size: smaller"><i class="fal fa-asterisk"></i></span>
|
<span style="font-size: smaller"><i class="fal fa-asterisk"></i></span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if workout.is_commute %}
|
||||||
|
Commute
|
||||||
|
{% endif %}
|
||||||
|
{% if workout.sub_type == "Warming Up" %}
|
||||||
|
Warming Up
|
||||||
|
{% elif workout.sub_type == "Cooling Down" %}
|
||||||
|
Cooling Down
|
||||||
|
{% endif %}
|
||||||
{% if workout.rpe == 0 and not workout.duplicate %}
|
{% if workout.rpe == 0 and not workout.duplicate %}
|
||||||
<span style="font-size: smaller">
|
<span style="font-size: smaller">
|
||||||
<a href="/rowers/workout/{{ workout.id|encode }}/edit/">No RPE</a>
|
<a href="/rowers/workout/{{ workout.id|encode }}/edit/">No RPE</a>
|
||||||
@@ -207,7 +221,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
{% elif show_commutes and user.rower.small_commutes %}
|
{% elif workout|show_commute %}
|
||||||
<li class="grid_4 divlines">
|
<li class="grid_4 divlines">
|
||||||
<div class="workoutcontainer">
|
<div class="workoutcontainer">
|
||||||
<div class="workoutelement">
|
<div class="workoutelement">
|
||||||
@@ -251,6 +265,54 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
{% elif workout|show_wup_cd %}
|
||||||
|
<li class="grid_4 divlines">
|
||||||
|
<div class="workoutcontainer">
|
||||||
|
<div class="workoutelement">
|
||||||
|
{% if workout.sub_type == "Warming Up" %}
|
||||||
|
<span style="font-size: smaller"><i class="fa-solid fa-temperature-arrow-up"></i></span>
|
||||||
|
{% else %}
|
||||||
|
<span style="font-size: smaller"><i class="fa-solid fa-temperature-arrow-down"></i></span>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="workoutelement">
|
||||||
|
<span style="color:#555">Distance</span>
|
||||||
|
{{ workout.distance|distanceprint }}
|
||||||
|
</div>
|
||||||
|
<div class="workoutelement">
|
||||||
|
<span style="color:#555">Time</span>
|
||||||
|
{{ workout.duration |durationprint:"%H:%M:%S.%f" }}
|
||||||
|
</div>
|
||||||
|
<div class="workoutelement">
|
||||||
|
{% if workout|may_edit:request %}
|
||||||
|
<a class="small"
|
||||||
|
href={% url rower.defaultlandingpage id=workout.id|encode %}
|
||||||
|
title="{{ rower.defaultlandingpage|verbose }}">
|
||||||
|
<i class="{{ rower.defaultlandingpage|landingicon }}"></i></a>
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="workoutelement">
|
||||||
|
{% if workout|may_edit:request %}
|
||||||
|
{% if rower.defaultlandingpage2 != 'workout_delete' %}
|
||||||
|
<a class="small"
|
||||||
|
href={% url rower.defaultlandingpage2 id=workout.id|encode %}
|
||||||
|
title="{{ rower.defaultlandingpage2|verbose }}">
|
||||||
|
<i class="{{ rower.defaultlandingpage2|landingicon }}"></i></a>
|
||||||
|
{% else %}
|
||||||
|
<a class="small"
|
||||||
|
href={% url rower.defaultlandingpage2 id=workout.id|encode %}
|
||||||
|
title="{{ rower.defaultlandingpage2|verbose }}">
|
||||||
|
<i class="{{ rower.defaultlandingpage2|landingicon }}"></i></a>
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -48,6 +48,25 @@ from six import string_types
|
|||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def show_normal(workout):
|
||||||
|
# is commute
|
||||||
|
hide_commute = workout.is_commute and (workout.user.small_commutes or not workout.user.show_commutes)
|
||||||
|
hide_warmup = workout.sub_type in ["Warming Up", "Cooling Down"] and (workout.user.small_wups_cds or not workout.user.show_wups_cds)
|
||||||
|
return not hide_commute and not hide_warmup
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def show_commute(workout):
|
||||||
|
return workout.is_commute and workout.user.small_commutes
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def show_wup_cd(workout):
|
||||||
|
return workout.sub_type in ["Warming Up", "Cooling Down"] and workout.user.small_wups_cds
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def is_wup_cd(workout):
|
||||||
|
return workout.sub_type in ["Warm Up", "Cooling Down"]
|
||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
def getworkoutname(id):
|
def getworkoutname(id):
|
||||||
try:
|
try:
|
||||||
|
|||||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
@@ -2156,6 +2156,8 @@ def workouts_view(request, message='', successmessage='',
|
|||||||
show_commutes = request.GET.get('show_commutes', False)
|
show_commutes = request.GET.get('show_commutes', False)
|
||||||
if show_commutes == 'true':
|
if show_commutes == 'true':
|
||||||
show_commutes = True
|
show_commutes = True
|
||||||
|
|
||||||
|
show_wups_cds = request.GET.get('show_wups_cds', False)
|
||||||
|
|
||||||
# check if access is allowed
|
# check if access is allowed
|
||||||
|
|
||||||
@@ -2281,8 +2283,13 @@ def workouts_view(request, message='', successmessage='',
|
|||||||
if not show_commutes:
|
if not show_commutes:
|
||||||
nr_commutes = workouts.filter(is_commute=True).count()
|
nr_commutes = workouts.filter(is_commute=True).count()
|
||||||
workouts = workouts.exclude(is_commute=True)
|
workouts = workouts.exclude(is_commute=True)
|
||||||
|
|
||||||
|
nr_wups_cds = 0
|
||||||
|
show_wups_cds = show_wups_cds or r.show_wups_cds
|
||||||
|
if not show_wups_cds:
|
||||||
|
nr_wups_cds = workouts.filter(sub_type__in=['Warming Up', 'Cooling Down']).count()
|
||||||
|
workouts = workouts.exclude(sub_type='Warming Up').exclude(sub_type='Cooling Down')
|
||||||
|
|
||||||
workoutsnohr = workouts.exclude(averagehr__isnull=False)
|
workoutsnohr = workouts.exclude(averagehr__isnull=False)
|
||||||
for w in workoutsnohr: # pragma: no cover
|
for w in workoutsnohr: # pragma: no cover
|
||||||
_ = dataprep.workout_trimp(w)
|
_ = dataprep.workout_trimp(w)
|
||||||
@@ -2375,6 +2382,8 @@ def workouts_view(request, message='', successmessage='',
|
|||||||
'totalhours': totalhours,
|
'totalhours': totalhours,
|
||||||
'nr_commutes': nr_commutes,
|
'nr_commutes': nr_commutes,
|
||||||
'show_commutes': show_commutes,
|
'show_commutes': show_commutes,
|
||||||
|
'show_wups_cds': show_wups_cds,
|
||||||
|
'nr_wups_cds': nr_wups_cds,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user