chart axes choice on multi compare view
This commit is contained in:
@@ -891,7 +891,8 @@ def interactive_cum_flex_chart2(theworkouts,promember=0,
|
||||
|
||||
|
||||
yparamname1 = axlabels[yparam1]
|
||||
yparamname2 = axlabels[yparam2]
|
||||
if yparam2 != 'None':
|
||||
yparamname2 = axlabels[yparam2]
|
||||
|
||||
|
||||
datadf = datadf[datadf[yparam1] > 0]
|
||||
@@ -1668,8 +1669,6 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
|
||||
if yparam != 'time' and yparam != 'pace':
|
||||
plot.add_layout(ylabel)
|
||||
|
||||
print cntr,id,len(group),ymean
|
||||
|
||||
source = ColumnDataSource(
|
||||
group
|
||||
)
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
<div id="workouts_table" class="grid_8 alpha">
|
||||
{% if team %}
|
||||
{% include "teambuttons.html" with teamid=team.id %}
|
||||
<h3>{{ team.name }} Team Workouts</h3>
|
||||
{% else %}
|
||||
<h3>My Workouts</h3>
|
||||
|
||||
@@ -34,25 +34,33 @@
|
||||
</style>
|
||||
|
||||
|
||||
<div id="workouts" class="grid_12 alpha">
|
||||
<div id="workouts" class="grid_8 alpha">
|
||||
<h1>Interactive Comparison</h1>
|
||||
<div class="grid_2 alpha">
|
||||
<a class="button gray small" href="/rowers/list-workouts/team/{{ teamid }}/">Team Workouts</a>
|
||||
<div class="grid_8 alpha">
|
||||
{% include "teambuttons.html" with teamid=teamid%}
|
||||
</div>
|
||||
<div class="grid_2">
|
||||
<a class="button gray small" href="/rowers/team-compare-select/team/{{ teamid }}/">Multi Compare</a>
|
||||
</div>
|
||||
<div class="grid_2 suffix_6 omega">
|
||||
<a class="button gray small" href="/rowers/team/{{ teamid }}/">Team Page</a>
|
||||
</div>
|
||||
<div class="grid_12 alpha">
|
||||
</div>
|
||||
<div class="grid_4 omega">
|
||||
<form enctype="multipart/form-data" action="/rowers/multi-compare" method="post">
|
||||
{% csrf_token %}
|
||||
<table>
|
||||
{{ chartform.as_table }}
|
||||
</table>
|
||||
<div class="grid_1 prefix_2 suffix_1">
|
||||
<p>
|
||||
<input name='workoutselectform' class="button green" type="submit" value="Submit">
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="grid_12 alpha">
|
||||
|
||||
|
||||
|
||||
<div id="theplot" class="grid_12 alpha flexplot">
|
||||
{{ the_div|safe }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -5,30 +5,40 @@
|
||||
{% block content %}
|
||||
<div class="grid_12 alpha">
|
||||
<h1>{{ team.name }}</h1>
|
||||
<p>{{ team.notes }}</p>
|
||||
<p><b>Manager:</b> {{ team.manager.first_name }} {{ team.manager.last_name }}</p>
|
||||
<div class="grid_8 alpha">
|
||||
{% include "teambuttons.html" with teamid=team.id %}
|
||||
</div>
|
||||
<div class="grid_4 omega">
|
||||
<p>{{ team.notes }}</p>
|
||||
<p><b>Manager:</b> {{ team.manager.first_name }} {{ team.manager.last_name }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_12 alpha">
|
||||
{% if ismember %}
|
||||
<div class="grid_2 alpha">
|
||||
<a class="button red small" href="/rowers/team/{{ team.id }}/leaveconfirm">Leave this team</a>
|
||||
</div>
|
||||
{% if team.manager == user %}
|
||||
<div class="grid_2 suffix_8 omega">
|
||||
<a class="button blue small" href="/rowers/team/{{ team.id }}/edit">Edit Team</a>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="grid_2 suffix_8 omega">
|
||||
<p>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% elif hasrequested %}
|
||||
<div class="grid_2 alpha">
|
||||
<a class="button red small" href="/rowers/team/{{ team.id }}/leaveconfirm">Leave this team</a>
|
||||
</div>
|
||||
{% if team.manager == user %}
|
||||
<div class="grid_2 suffix_8 omega">
|
||||
<a class="button blue small" href="/rowers/team/{{ team.id }}/edit">Edit Team</a>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="grid_2 suffix_8 omega">
|
||||
<p>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% elif hasrequested %}
|
||||
<p>You have requested access to this team</p>
|
||||
{% else %}
|
||||
<div class="grid_2 suffix_10 alpha tooltip">
|
||||
<a class="button green small" href="/rowers/team/{{ team.id }}/requestmembership/{{ user.id }}">Join</a>
|
||||
<span class="tooltiptext">A request will be sent to the team manager</span>
|
||||
{% else %}
|
||||
<div class="grid_2 suffix_10 alpha tooltip">
|
||||
<a class="button green small" href="/rowers/team/{{ team.id }}/requestmembership/{{ user.id }}">Join</a>
|
||||
<span class="tooltiptext">A request will be sent to the team manager</span>
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="grid_12 alpha">
|
||||
<div class="grid_6 alpha">
|
||||
<p>
|
||||
<h2>Members</h2>
|
||||
@@ -59,19 +69,19 @@
|
||||
<div class="grid_6 omega">
|
||||
{% if team.manager == user %}
|
||||
<p>Use the form to add a new user. You can either select a user from the list of your existing club members who are not on this team yet, or you can type the user's email address, which also works for users who have not registered to the site yet.</p>
|
||||
{% if inviteform.errors %}
|
||||
<p style="color: red;">
|
||||
Please correct the error{{ inviteform.errors|pluralize }} below.
|
||||
</p>
|
||||
{% if inviteform.errors %}
|
||||
<p style="color: red;">
|
||||
Please correct the error{{ inviteform.errors|pluralize }} below.
|
||||
</p>
|
||||
{% endif %}
|
||||
<form enctype="multipart/form-data" action="{{ formloc }}" method="post">
|
||||
<table>
|
||||
{{ inviteform.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
<div id="formbutton" class="grid_1 prefix_4 suffix_1">
|
||||
<table>
|
||||
{{ inviteform.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
<div id="formbutton" class="grid_1 prefix_4 suffix_1">
|
||||
<input class="button green" type="submit" value="Submit">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% else %}
|
||||
<p>
|
||||
|
||||
@@ -8,8 +8,15 @@
|
||||
|
||||
|
||||
<div class="grid_12">
|
||||
|
||||
<div class="grid_4 alpha">
|
||||
<div class="grid_8 suffix_4">
|
||||
{% include "teambuttons.html" with teamid=teamid%}
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_12 alpha">
|
||||
<h3>{{ team.name }} Team Workouts</h3>
|
||||
</div>
|
||||
<div class="grid_12 alpha">
|
||||
<div class="grid_4 alpha">
|
||||
|
||||
{% if team %}
|
||||
<form enctype="multipart/form-data" action="/rowers/team-compare-select/team/{{ team.id }}/" method="post">
|
||||
@@ -46,9 +53,6 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div class="grid_12 alpha">
|
||||
<h3>{{ team.name }} Team Workouts</h3>
|
||||
</div>
|
||||
|
||||
<form enctype="multipart/form-data" action="/rowers/multi-compare" method="post">
|
||||
<div id="workouts_table" class="grid_8 alpha">
|
||||
|
||||
9
rowers/templates/teambuttons.html
Normal file
9
rowers/templates/teambuttons.html
Normal file
@@ -0,0 +1,9 @@
|
||||
<div class="grid_2 alpha">
|
||||
<a class="button gray small" href="/rowers/list-workouts/team/{{ teamid }}/">Team Workouts</a>
|
||||
</div>
|
||||
<div class="grid_2">
|
||||
<a class="button gray small" href="/rowers/team-compare-select/team/{{ teamid }}/">Multi Compare</a>
|
||||
</div>
|
||||
<div class="grid_2 suffix_2 omega">
|
||||
<a class="button gray small" href="/rowers/team/{{ teamid }}/">Team Page</a>
|
||||
</div>
|
||||
@@ -2057,9 +2057,14 @@ def multi_compare_view(request):
|
||||
r = Rower.objects.get(user=request.user)
|
||||
result = request.user.is_authenticated() and ispromember(request.user)
|
||||
if result:
|
||||
promember=1
|
||||
promember=1
|
||||
|
||||
if request.method == 'POST':
|
||||
if 'ids' in request.session:
|
||||
print request.session['ids']
|
||||
|
||||
print request.POST
|
||||
|
||||
if request.method == 'POST' and 'workouts' in request.POST:
|
||||
form = WorkoutMultipleCompareForm(request.POST)
|
||||
chartform = ChartParamChoiceForm(request.POST)
|
||||
if form.is_valid() and chartform.is_valid():
|
||||
@@ -2070,6 +2075,8 @@ def multi_compare_view(request):
|
||||
plottype = chartform.cleaned_data['plottype']
|
||||
teamid = chartform.cleaned_data['teamid']
|
||||
ids = [int(w.id) for w in workouts]
|
||||
request.session['ids'] = ids
|
||||
|
||||
labeldict = {
|
||||
int(w.id): w.__unicode__() for w in workouts
|
||||
}
|
||||
@@ -2086,9 +2093,40 @@ def multi_compare_view(request):
|
||||
'the_div':div,
|
||||
'promember':promember,
|
||||
'teamid':teamid,
|
||||
'chartform':chartform,
|
||||
})
|
||||
else:
|
||||
return HttpResponse("Form is not valid")
|
||||
if request.method == 'POST' and 'ids' in request.session:
|
||||
chartform = ChartParamChoiceForm(request.POST)
|
||||
if chartform.is_valid():
|
||||
xparam = chartform.cleaned_data['xparam']
|
||||
yparam = chartform.cleaned_data['yparam']
|
||||
plottype = chartform.cleaned_data['plottype']
|
||||
teamid = chartform.cleaned_data['teamid']
|
||||
ids = request.session['ids']
|
||||
request.session['ids'] = ids
|
||||
workouts = [Workout.objects.get(id=id) for id in ids]
|
||||
|
||||
labeldict = {
|
||||
int(w.id): w.__unicode__() for w in workouts
|
||||
}
|
||||
|
||||
res = interactive_multiple_compare_chart(ids,xparam,yparam,
|
||||
promember=promember,
|
||||
plottype=plottype,
|
||||
labeldict=labeldict)
|
||||
script = res[0]
|
||||
div = res[1]
|
||||
|
||||
return render(request,'multicompare.html',
|
||||
{'interactiveplot':script,
|
||||
'the_div':div,
|
||||
'promember':promember,
|
||||
'teamid':teamid,
|
||||
'chartform':chartform,
|
||||
})
|
||||
|
||||
else:
|
||||
url = reverse(workouts_view)
|
||||
return HttpResponseRedirect(url)
|
||||
@@ -5625,8 +5663,6 @@ def rower_teams_view(request,message='',successmessage=''):
|
||||
requests = TeamRequest.objects.filter(user=request.user)
|
||||
myrequests = TeamRequest.objects.filter(team__in=myteams)
|
||||
myinvites = TeamInvite.objects.filter(team__in=myteams)
|
||||
|
||||
print form
|
||||
|
||||
return render(request, 'teams.html',
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user