Private
Public Access
1
0

Merge branch 'release/v3.14'

This commit is contained in:
Sander Roosendaal
2017-06-13 22:45:16 +02:00
3 changed files with 48 additions and 6 deletions

View File

@@ -2344,6 +2344,9 @@ def interactive_comparison_chart(id1=0,id2=0,xparam='distance',yparam='spm',
data2
)
ymean1 = data1['y1'].mean()
ymean2 = data2['y2'].mean()
# create interactive plot
plot = Figure(x_axis_type=x_axis_type,y_axis_type=y_axis_type,
tools=TOOLS,
@@ -2412,6 +2415,25 @@ def interactive_comparison_chart(id1=0,id2=0,xparam='distance',yparam='spm',
plot.xaxis.axis_label = axlabels[xparam]
plot.yaxis.axis_label = axlabels[yparam]
ylabel1 = Label(x=100,y=90,x_units='screen',y_units='screen',
text=axlabels[yparam]+": {ymean1:6.2f}".format(
ymean1=ymean1
),
background_fill_alpha=.7,
background_fill_color='white',
text_color='blue'
)
ylabel2 = Label(x=100,y=110,x_units='screen',y_units='screen',
text=axlabels[yparam]+": {ymean2:6.2f}".format(
ymean2=ymean2
),
background_fill_alpha=.7,
background_fill_color='white',
text_color='red'
)
plot.add_layout(ylabel1)
plot.add_layout(ylabel2)
if xparam == 'time':
plot.xaxis[0].formatter = DatetimeTickFormatter(
hours = ["%H"],

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

@@ -3127,6 +3127,8 @@ def team_comparison_select(request,
r = getrower(request.user)
except Rower.DoesNotExist:
raise Http404("Rower doesn't exist")
if request.method == 'POST':
dateform = DateRangeForm(request.POST)
@@ -3156,13 +3158,16 @@ 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 r.rowerplan == 'basic' and theteam==0:
raise Http404("Not allowed")
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 +3192,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)