Private
Public Access
1
0

multi compare for pro members

This commit is contained in:
Sander Roosendaal
2017-06-13 22:25:00 +02:00
parent ba7709e6c8
commit 0506eb36aa
2 changed files with 21 additions and 6 deletions

View File

@@ -83,7 +83,7 @@
</div>
<div class="grid_6 omega">
<div class="grid_2 suffix_4 alpha">
<div class="grid_2 alpha">
<p>
{% if user.rower.rowerplan == 'pro' or user.rower.rowerplan == 'coach' %}
<a class="button blue small" href="/rowers/otw-bests">OTW Ranking Pieces</a>
@@ -95,7 +95,17 @@
Analyse power vs piece duration to make predictions.
</p>
</div>
<div class="grid_2 suffix_2 omega">
<p>
{% if user.rower.rowerplan == 'pro' or user.rower.rowerplan == 'coach' %}
<a class="button blue small" href="/rowers/team-compare-select/team/0/">Multi Compare</a>
{% else %}
{% endif %}
</p>
<p>
Compare many workouts
</p>
</div>
</div>
</div>

View File

@@ -3156,13 +3156,13 @@ def team_comparison_select(request,
try:
theteam = Team.objects.get(id=teamid)
except Team.DoesNotExist:
raise Http404("Team doesn't exist")
theteam = 0
if theteam.viewing == 'allmembers' or theteam.manager == request.user:
if theteam and (theteam.viewing == 'allmembers' or theteam.manager == request.user):
workouts = Workout.objects.filter(team=theteam,
startdatetime__gte=startdate,
startdatetime__lte=enddate).order_by("-date", "-starttime")
elif theteam.viewing == 'coachonly':
elif theteam and theteam.viewing == 'coachonly':
workouts = Workout.objects.filter(team=theteam,user=r,
startdatetime__gte=startdate,
startdatetime__lte=enddate).order_by("-date","-starttime")
@@ -3187,7 +3187,12 @@ def team_comparison_select(request,
form = WorkoutMultipleCompareForm()
form.fields["workouts"].queryset = workouts
chartform = ChartParamChoiceForm(initial={'teamid':theteam.id})
if theteam:
theid = theteam.id
else:
theid = 0
chartform = ChartParamChoiceForm(initial={'teamid':0})
messages.info(request,successmessage)
messages.error(request,message)