fix
This commit is contained in:
@@ -90,7 +90,6 @@ zien welk ploeglid bij Willem III roeit en welk ploeglid bij De Hoop.</p>
|
||||
<li>Spaarne Lenterace</li>
|
||||
<li>Dutch Masters Open (alleen uitslagen van races die zonder startverschil worden geroeid)</li>
|
||||
<li>Cottwich</li>
|
||||
<li>Eemhead</li>
|
||||
<li>Tromp Boat Races</li>
|
||||
<li>Novembervieren</li>
|
||||
</ul>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<h1>In Stroke Metrics</h1>
|
||||
<ul class="main-content">
|
||||
<li class="grid_4">
|
||||
{% if user.rower.rowerplan == 'basic' %}
|
||||
{% if user.rower|is_basic %}
|
||||
|
||||
<p>
|
||||
This is a preview of the page with advanced functionality for Pro users.
|
||||
@@ -40,20 +40,15 @@
|
||||
|
||||
<li>
|
||||
{% if instrokemetrics %}
|
||||
{% for metric in instrokemetrics %}
|
||||
<p>
|
||||
<a href="/rowers/workout/{{ workout.id|encode }}/instroke/{{ metric }}/">{{ metric }}</a>
|
||||
</p>
|
||||
{% endfor %}
|
||||
<p>
|
||||
<a href="/rowers/workout/{{ workout.id|encode }}/instroke/interactive/">NEW: Dynamic</a>
|
||||
<a href="/rowers/workout/{{ workout.id|encode }}/instroke/interactive/">Dynamic</a>
|
||||
</p>
|
||||
{% else %}
|
||||
<p>Unfortunately, this workout doesn't have any in stroke metrics</p>
|
||||
{% endif %}
|
||||
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
@@ -119,10 +119,15 @@ $( function() {
|
||||
|
||||
<h1>In Stroke Metrics</h1>
|
||||
<ul class="main-content">
|
||||
<li class="grid_4">
|
||||
<p>This is an experimental prototype. It's behavior is not guaranteed. Response may be slow.
|
||||
</li>
|
||||
<li class="grid_4" >
|
||||
{% if user.rower|is_basic %}
|
||||
|
||||
<p>
|
||||
This is a preview of the page with advanced functionality for Pro users.
|
||||
See <a href="/rowers/about/">the About page</a> for more information
|
||||
and to sign up for Pro Membership
|
||||
</p>
|
||||
{% endif %}
|
||||
<form id="instrokeform" enctype="multipart/form-data" action="" method="post">
|
||||
{% csrf_token %}
|
||||
<table>
|
||||
|
||||
@@ -334,7 +334,7 @@
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<li id="advanced-instroke">
|
||||
<a href="/rowers/workout/{{ workout.id|encode }}/instroke/">
|
||||
<a href="/rowers/workout/{{ workout.id|encode }}/instroke/interactive/">
|
||||
<i class="fas fa-search-plus fa-fw"></i>
|
||||
In-Stroke Metrics
|
||||
</a>
|
||||
|
||||
@@ -26,7 +26,7 @@ from rowers.teams import coach_getcoachees
|
||||
from rowers import credits
|
||||
from rowers import c2stuff
|
||||
from rowers.c2stuff import c2_open
|
||||
from rowers.rower_rules import is_coach_user, is_workout_user, isplanmember, ispromember
|
||||
from rowers.rower_rules import *
|
||||
from rowers.mytypes import (
|
||||
otwtypes, adaptivetypes, sexcategories, weightcategories, workouttypes,
|
||||
workouttypes_icons)
|
||||
@@ -252,8 +252,11 @@ def nogoals(user):
|
||||
|
||||
@register.filter
|
||||
def notfree(rower):
|
||||
return rower.rowerplan not in ['basic', 'freecoach']
|
||||
return user_is_not_basic(rower.user)
|
||||
|
||||
@register.filter
|
||||
def is_basic(rower):
|
||||
return not user_is_not_basic(rower.user)
|
||||
|
||||
def strfdelta(tdelta):
|
||||
minutes, seconds = divmod(tdelta.seconds, 60)
|
||||
@@ -606,12 +609,10 @@ def mayeditplan(obj, request):
|
||||
if obj.manager is not None:
|
||||
return request.user == obj.manager.user
|
||||
|
||||
rr = Rower.objects.get(user=request.user) # pragma: no cover
|
||||
if is_coach_user(request.user, obj.rower) and rr.rowerplan not in ['basic', 'pro']: # pragma: no cover
|
||||
mayedit = True
|
||||
|
||||
return mayedit # pragma: no cover
|
||||
if can_plan(request.user) and is_coach_user(request.user, obj.rower):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
@register.filter
|
||||
def iterrows(df): # pragma: no cover
|
||||
@@ -744,7 +745,7 @@ def openactions(user):
|
||||
def team_rowers(user): # pragma: no cover
|
||||
try:
|
||||
therower = Rower.objects.get(user=user)
|
||||
if therower.rowerplan == 'basic':
|
||||
if not user_is_not_basic(user):
|
||||
return []
|
||||
teams = Team.objects.filter(manager=user)
|
||||
members = Rower.objects.filter(
|
||||
|
||||
@@ -2927,6 +2927,54 @@ def instroke_chart_interactive(request, id=0):
|
||||
|
||||
form = InstrokeForm(choices=instrokemetrics)
|
||||
|
||||
breadcrumbs = [
|
||||
{
|
||||
'url': '/rowers/list-workouts/',
|
||||
'name': 'Workouts'
|
||||
},
|
||||
{
|
||||
'url': get_workout_default_page(request, id),
|
||||
'name': w.name
|
||||
},
|
||||
{
|
||||
'url': reverse('instroke_view', kwargs={'id': id}),
|
||||
'name': 'In-Stroke Metrics'
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
if not instrokemetrics:
|
||||
script = ''
|
||||
div = 'No Instroke Metrics available for this workout'
|
||||
spm_min = 15
|
||||
spm_max = 45
|
||||
ds = ''
|
||||
dd = ''
|
||||
activeminutesmin = 0
|
||||
activeminutesmax = int(rowdata.duration/60.)
|
||||
maxminutes = activeminutesmax
|
||||
|
||||
return render(request,
|
||||
'instroke_interactive.html',
|
||||
{
|
||||
'workout': w,
|
||||
'rower': w.user,
|
||||
'active': 'nav-workouts',
|
||||
'breadcrumbs': breadcrumbs,
|
||||
'teams': get_my_teams(request.user),
|
||||
'instrokemetrics': instrokemetrics,
|
||||
'form':form,
|
||||
'the_script': script,
|
||||
'the_div': div,
|
||||
'spm_min': spm_min,
|
||||
'spm_max': spm_max,
|
||||
'ds': ds,
|
||||
'dd': dd,
|
||||
'activeminutesmin': activeminutesmin,
|
||||
'activeminutesmax': activeminutesmax,
|
||||
'maxminutes': maxminutes,
|
||||
})
|
||||
|
||||
script = ''
|
||||
div = get_call()
|
||||
|
||||
@@ -2991,23 +3039,6 @@ def instroke_chart_interactive(request, id=0):
|
||||
id), promember=1, intervaldata=intervaldata)
|
||||
|
||||
|
||||
|
||||
breadcrumbs = [
|
||||
{
|
||||
'url': '/rowers/list-workouts/',
|
||||
'name': 'Workouts'
|
||||
},
|
||||
{
|
||||
'url': get_workout_default_page(request, id),
|
||||
'name': w.name
|
||||
},
|
||||
{
|
||||
'url': reverse('instroke_view', kwargs={'id': id}),
|
||||
'name': 'In-Stroke Metrics'
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
if is_ajax:
|
||||
response = json.dumps({
|
||||
'script': script,
|
||||
|
||||
Reference in New Issue
Block a user