analysisviews pep
This commit is contained in:
@@ -1,11 +1,7 @@
|
|||||||
import time
|
|
||||||
from rowers.forms import analysischoices
|
from rowers.forms import analysischoices
|
||||||
from django.contrib.staticfiles import finders
|
|
||||||
from rowers.views.statements import *
|
from rowers.views.statements import *
|
||||||
|
|
||||||
import collections
|
from jinja2 import Environment, FileSystemLoader
|
||||||
import simplejson
|
|
||||||
from jinja2 import Template, Environment, FileSystemLoader
|
|
||||||
from rowers.rower_rules import can_view_session
|
from rowers.rower_rules import can_view_session
|
||||||
|
|
||||||
|
|
||||||
@@ -28,10 +24,16 @@ defaultoptions = {
|
|||||||
|
|
||||||
|
|
||||||
@user_passes_test(ispromember, login_url="/rowers/paidplans",
|
@user_passes_test(ispromember, login_url="/rowers/paidplans",
|
||||||
message="This functionality requires a Pro plan or higher. If you are already a Pro user, please log in to access this functionality",
|
message="This functionality requires a Pro plan or higher."
|
||||||
|
" If you are already a Pro user,"
|
||||||
|
" please log in to access this functionality",
|
||||||
redirect_field_name=None)
|
redirect_field_name=None)
|
||||||
@permission_required('rower.is_coach', fn=get_user_by_userid, raise_exception=True)
|
@permission_required('rower.is_coach',
|
||||||
def analysis_new(request, userid=0, function='boxplot', teamid=0, id='', session=0):
|
fn=get_user_by_userid,
|
||||||
|
raise_exception=True)
|
||||||
|
def analysis_new(request,
|
||||||
|
userid=0,
|
||||||
|
function='boxplot', teamid=0, id='', session=0):
|
||||||
r = getrequestrower(request, userid=userid)
|
r = getrequestrower(request, userid=userid)
|
||||||
user = r.user
|
user = r.user
|
||||||
userid = user.id
|
userid = user.id
|
||||||
@@ -62,10 +64,6 @@ def analysis_new(request, userid=0, function='boxplot', teamid=0, id='', session
|
|||||||
options = defaultoptions
|
options = defaultoptions
|
||||||
|
|
||||||
options['userid'] = userid
|
options['userid'] = userid
|
||||||
try:
|
|
||||||
workouttypes = options['workouttypes']
|
|
||||||
except KeyError: # pragma: no cover
|
|
||||||
workouttypes = ['rower', 'dynamic', 'slides']
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
modalities = options['modalities']
|
modalities = options['modalities']
|
||||||
@@ -79,11 +77,6 @@ def analysis_new(request, userid=0, function='boxplot', teamid=0, id='', session
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
worldclass = False
|
worldclass = False
|
||||||
|
|
||||||
try:
|
|
||||||
includereststrokes = options['includereststrokes']
|
|
||||||
except KeyError: # pragma: no cover
|
|
||||||
includereststrokes = False
|
|
||||||
|
|
||||||
if 'startdate' in request.session:
|
if 'startdate' in request.session:
|
||||||
startdate = iso8601.parse_date(request.session['startdate'])
|
startdate = iso8601.parse_date(request.session['startdate'])
|
||||||
else:
|
else:
|
||||||
@@ -97,8 +90,6 @@ def analysis_new(request, userid=0, function='boxplot', teamid=0, id='', session
|
|||||||
else:
|
else:
|
||||||
enddate = timezone.now()
|
enddate = timezone.now()
|
||||||
|
|
||||||
workstrokesonly = not includereststrokes
|
|
||||||
|
|
||||||
waterboattype = mytypes.waterboattype
|
waterboattype = mytypes.waterboattype
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
@@ -296,15 +287,9 @@ def trendflexdata(workouts, options, userid=0):
|
|||||||
workmin = options['workmin']
|
workmin = options['workmin']
|
||||||
workmax = options['workmax']
|
workmax = options['workmax']
|
||||||
ploterrorbars = options['ploterrorbars']
|
ploterrorbars = options['ploterrorbars']
|
||||||
cpfit = options['cpfit']
|
|
||||||
piece = options['piece']
|
|
||||||
ids = options['ids']
|
ids = options['ids']
|
||||||
workstrokesonly = not includereststrokes
|
workstrokesonly = not includereststrokes
|
||||||
|
|
||||||
labeldict = {
|
|
||||||
int(w.id): w.__str__() for w in workouts
|
|
||||||
}
|
|
||||||
|
|
||||||
fieldlist, fielddict = dataprep.getstatsfields()
|
fieldlist, fielddict = dataprep.getstatsfields()
|
||||||
fieldlist = [xparam, yparam, groupby,
|
fieldlist = [xparam, yparam, groupby,
|
||||||
'workoutid', 'spm', 'driveenergy',
|
'workoutid', 'spm', 'driveenergy',
|
||||||
@@ -315,7 +300,7 @@ def trendflexdata(workouts, options, userid=0):
|
|||||||
|
|
||||||
if xparam == groupby: # pragma: no cover
|
if xparam == groupby: # pragma: no cover
|
||||||
datadf['groupby'] = datadf[xparam]
|
datadf['groupby'] = datadf[xparam]
|
||||||
groupy = 'groupby'
|
groupby = 'groupby'
|
||||||
|
|
||||||
datadf = dataprep.clean_df_stats(datadf, workstrokesonly=workstrokesonly)
|
datadf = dataprep.clean_df_stats(datadf, workstrokesonly=workstrokesonly)
|
||||||
|
|
||||||
@@ -497,16 +482,14 @@ def flexalldata(workouts, options):
|
|||||||
def histodata(workouts, options):
|
def histodata(workouts, options):
|
||||||
includereststrokes = options['includereststrokes']
|
includereststrokes = options['includereststrokes']
|
||||||
plotfield = options['plotfield']
|
plotfield = options['plotfield']
|
||||||
function = options['function']
|
|
||||||
spmmin = options['spmmin']
|
spmmin = options['spmmin']
|
||||||
spmmax = options['spmmax']
|
spmmax = options['spmmax']
|
||||||
workmin = options['workmin']
|
workmin = options['workmin']
|
||||||
workmax = options['workmax']
|
workmax = options['workmax']
|
||||||
|
|
||||||
workstrokesonly = not includereststrokes
|
|
||||||
|
|
||||||
script, div = interactive_histoall(workouts, plotfield, includereststrokes,
|
script, div = interactive_histoall(workouts, plotfield, includereststrokes,
|
||||||
spmmin=spmmin, spmmax=spmmax, workmin=workmin, workmax=workmax)
|
spmmin=spmmin, spmmax=spmmax,
|
||||||
|
workmin=workmin, workmax=workmax)
|
||||||
|
|
||||||
scripta = script.split('\n')[2:-1]
|
scripta = script.split('\n')[2:-1]
|
||||||
script = ''.join(scripta)
|
script = ''.join(scripta)
|
||||||
@@ -522,7 +505,6 @@ def cpdata(workouts, options):
|
|||||||
u = User.objects.get(id=userid)
|
u = User.objects.get(id=userid)
|
||||||
r = u.rower
|
r = u.rower
|
||||||
|
|
||||||
ids = [w.id for w in workouts]
|
|
||||||
delta, cpvalue, avgpower, workoutnames, urls = dataprep.fetchcp_new(
|
delta, cpvalue, avgpower, workoutnames, urls = dataprep.fetchcp_new(
|
||||||
r, workouts)
|
r, workouts)
|
||||||
|
|
||||||
@@ -565,7 +547,6 @@ def cpdata(workouts, options):
|
|||||||
if r.birthdate:
|
if r.birthdate:
|
||||||
age = calculate_age(r.birthdate)
|
age = calculate_age(r.birthdate)
|
||||||
else: # pragma: no cover
|
else: # pragma: no cover
|
||||||
worldclasspower = None
|
|
||||||
age = 0
|
age = 0
|
||||||
|
|
||||||
agerecords = CalcAgePerformance.objects.filter(
|
agerecords = CalcAgePerformance.objects.filter(
|
||||||
@@ -597,17 +578,11 @@ def cpdata(workouts, options):
|
|||||||
div = res[1]
|
div = res[1]
|
||||||
p1 = res[2]
|
p1 = res[2]
|
||||||
ratio = res[3]
|
ratio = res[3]
|
||||||
paulslope = 1
|
|
||||||
paulintercept = 1
|
|
||||||
message = res[4]
|
|
||||||
else: # pragma: no cover
|
else: # pragma: no cover
|
||||||
script = ''
|
script = ''
|
||||||
div = '<p>No ranking pieces found.</p>'
|
div = '<p>No ranking pieces found.</p>'
|
||||||
paulslope = 1
|
|
||||||
paulintercept = 1
|
|
||||||
p1 = [1, 1, 1, 1]
|
p1 = [1, 1, 1, 1]
|
||||||
ratio = 1
|
ratio = 1
|
||||||
message = ""
|
|
||||||
|
|
||||||
scripta = script.split('\n')[2:-1]
|
scripta = script.split('\n')[2:-1]
|
||||||
script = ''.join(scripta)
|
script = ''.join(scripta)
|
||||||
@@ -677,23 +652,12 @@ def cpdata(workouts, options):
|
|||||||
|
|
||||||
def statsdata(workouts, options):
|
def statsdata(workouts, options):
|
||||||
includereststrokes = options['includereststrokes']
|
includereststrokes = options['includereststrokes']
|
||||||
spmmin = options['spmmin']
|
|
||||||
spmmax = options['spmmax']
|
|
||||||
workmin = options['workmin']
|
|
||||||
workmax = options['workmax']
|
|
||||||
ids = options['ids']
|
ids = options['ids']
|
||||||
userid = options['userid']
|
|
||||||
plotfield = options['plotfield']
|
|
||||||
function = options['function']
|
|
||||||
|
|
||||||
workstrokesonly = not includereststrokes
|
workstrokesonly = not includereststrokes
|
||||||
|
|
||||||
ids = [w.id for w in workouts]
|
ids = [w.id for w in workouts]
|
||||||
|
|
||||||
datamapping = {
|
|
||||||
w.id: w.date for w in workouts
|
|
||||||
}
|
|
||||||
|
|
||||||
fieldlist, fielddict = dataprep.getstatsfields()
|
fieldlist, fielddict = dataprep.getstatsfields()
|
||||||
# prepare data frame
|
# prepare data frame
|
||||||
datadf, extracols = dataprep.read_cols_df_sql(ids, fieldlist)
|
datadf, extracols = dataprep.read_cols_df_sql(ids, fieldlist)
|
||||||
@@ -791,12 +755,8 @@ def boxplotdata(workouts, options):
|
|||||||
ids = options['ids']
|
ids = options['ids']
|
||||||
userid = options['userid']
|
userid = options['userid']
|
||||||
plotfield = options['plotfield']
|
plotfield = options['plotfield']
|
||||||
function = options['function']
|
|
||||||
|
|
||||||
workstrokesonly = not includereststrokes
|
workstrokesonly = not includereststrokes
|
||||||
labeldict = {
|
|
||||||
int(w.id): w.__str__() for w in workouts
|
|
||||||
}
|
|
||||||
|
|
||||||
datemapping = {
|
datemapping = {
|
||||||
w.id: w.date for w in workouts
|
w.id: w.date for w in workouts
|
||||||
@@ -838,7 +798,8 @@ def boxplotdata(workouts, options):
|
|||||||
|
|
||||||
script, div = interactive_boxchart(datadf, plotfield,
|
script, div = interactive_boxchart(datadf, plotfield,
|
||||||
extratitle=extratitle,
|
extratitle=extratitle,
|
||||||
spmmin=spmmin, spmmax=spmmax, workmin=workmin, workmax=workmax)
|
spmmin=spmmin, spmmax=spmmax,
|
||||||
|
workmin=workmin, workmax=workmax)
|
||||||
|
|
||||||
scripta = script.split('\n')[2:-1]
|
scripta = script.split('\n')[2:-1]
|
||||||
script = ''.join(scripta)
|
script = ''.join(scripta)
|
||||||
@@ -847,7 +808,8 @@ def boxplotdata(workouts, options):
|
|||||||
|
|
||||||
|
|
||||||
@user_passes_test(ispromember, login_url="/rowers/paidplans",
|
@user_passes_test(ispromember, login_url="/rowers/paidplans",
|
||||||
message="This functionality requires a Pro plan or higher. If you are already a Pro user, please log in to access this functionality",
|
message="This functionality requires a Pro plan or higher."
|
||||||
|
" If you are already a Pro user, please log in to access this functionality",
|
||||||
redirect_field_name=None)
|
redirect_field_name=None)
|
||||||
@permission_required('rower.is_coach', fn=get_user_by_userid, raise_exception=True)
|
@permission_required('rower.is_coach', fn=get_user_by_userid, raise_exception=True)
|
||||||
def analysis_view_data(request, userid=0):
|
def analysis_view_data(request, userid=0):
|
||||||
@@ -922,7 +884,8 @@ def planrequired_view(request):
|
|||||||
|
|
||||||
|
|
||||||
@user_passes_test(ispromember, login_url="/rowers/paidplans",
|
@user_passes_test(ispromember, login_url="/rowers/paidplans",
|
||||||
message="This functionality requires a Pro plan or higher. If you are already a Pro user, please log in to access this functionality",
|
message="This functionality requires a Pro plan or higher."
|
||||||
|
" If you are already a Pro user, please log in to access this functionality",
|
||||||
redirect_field_name=None)
|
redirect_field_name=None)
|
||||||
def create_marker_workouts_view(request, userid=0,
|
def create_marker_workouts_view(request, userid=0,
|
||||||
startdate=timezone.now()-timezone.timedelta(days=42),
|
startdate=timezone.now()-timezone.timedelta(days=42),
|
||||||
@@ -936,7 +899,7 @@ def create_marker_workouts_view(request, userid=0,
|
|||||||
duplicate=False).order_by('date')
|
duplicate=False).order_by('date')
|
||||||
|
|
||||||
for workout in workouts:
|
for workout in workouts:
|
||||||
w2 = dataprep.check_marker(workout)
|
_ = dataprep.check_marker(workout)
|
||||||
|
|
||||||
url = reverse('goldmedalscores_view',
|
url = reverse('goldmedalscores_view',
|
||||||
kwargs={
|
kwargs={
|
||||||
@@ -946,7 +909,8 @@ def create_marker_workouts_view(request, userid=0,
|
|||||||
|
|
||||||
|
|
||||||
@user_passes_test(ispromember, login_url="/rowers/paidplans",
|
@user_passes_test(ispromember, login_url="/rowers/paidplans",
|
||||||
message="This functionality requires a Pro plan or higher. If you are already a Pro user, please log in to access this functionality",
|
message="This functionality requires a Pro plan or higher."
|
||||||
|
" If you are already a Pro user, please log in to access this functionality",
|
||||||
redirect_field_name=None)
|
redirect_field_name=None)
|
||||||
def goldmedalscores_view(request, userid=0,
|
def goldmedalscores_view(request, userid=0,
|
||||||
startdate=timezone.now()-timezone.timedelta(days=365),
|
startdate=timezone.now()-timezone.timedelta(days=365),
|
||||||
@@ -1010,13 +974,11 @@ def goldmedalscores_view(request, userid=0,
|
|||||||
|
|
||||||
|
|
||||||
@user_passes_test(ispromember, login_url="/rowers/paidplans",
|
@user_passes_test(ispromember, login_url="/rowers/paidplans",
|
||||||
message="This functionality requires a Pro plan or higher. If you are already a Pro user, please log in to access this functionality",
|
message="This functionality requires a Pro plan or higher."
|
||||||
|
" If you are already a Pro user, please log in to access this functionality",
|
||||||
redirect_field_name=None)
|
redirect_field_name=None)
|
||||||
@permission_required('rower.is_coach', fn=get_user_by_userid, raise_exception=True)
|
@permission_required('rower.is_coach', fn=get_user_by_userid, raise_exception=True)
|
||||||
def trainingzones_view(request, userid=0):
|
def trainingzones_view(request, userid=0):
|
||||||
|
|
||||||
is_ajax = request_is_ajax(request)
|
|
||||||
|
|
||||||
r = getrequestrower(request, userid=userid)
|
r = getrequestrower(request, userid=userid)
|
||||||
|
|
||||||
enddate = timezone.now()
|
enddate = timezone.now()
|
||||||
@@ -1126,7 +1088,8 @@ def trainingzones_view_data(request, userid=0):
|
|||||||
|
|
||||||
|
|
||||||
@user_passes_test(ispromember, login_url="/rowers/paidplans",
|
@user_passes_test(ispromember, login_url="/rowers/paidplans",
|
||||||
message="This functionality requires a Pro plan or higher. If you are already a Pro user, please log in to access this functionality",
|
message="This functionality requires a Pro plan or higher."
|
||||||
|
" If you are already a Pro user, please log in to access this functionality",
|
||||||
redirect_field_name=None)
|
redirect_field_name=None)
|
||||||
@permission_required('rower.is_coach', fn=get_user_by_userid, raise_exception=True)
|
@permission_required('rower.is_coach', fn=get_user_by_userid, raise_exception=True)
|
||||||
def performancemanager_view(request, userid=0, mode='rower',
|
def performancemanager_view(request, userid=0, mode='rower',
|
||||||
@@ -1140,10 +1103,8 @@ def performancemanager_view(request, userid=0, mode='rower',
|
|||||||
|
|
||||||
kfitness = therower.kfit
|
kfitness = therower.kfit
|
||||||
kfatigue = therower.kfatigue
|
kfatigue = therower.kfatigue
|
||||||
fitnesstest = 20
|
|
||||||
metricchoice = 'hrtss'
|
metricchoice = 'hrtss'
|
||||||
modelchoice = 'tsb'
|
|
||||||
usegoldmedalstandard = False
|
|
||||||
doform = therower.showfresh
|
doform = therower.showfresh
|
||||||
dofatigue = therower.showfit
|
dofatigue = therower.showfit
|
||||||
|
|
||||||
@@ -1223,8 +1184,6 @@ def ajax_agegrouprecords(request,
|
|||||||
weightcategory='hwt',
|
weightcategory='hwt',
|
||||||
userid=0):
|
userid=0):
|
||||||
|
|
||||||
wcdurations = []
|
|
||||||
wcpower = []
|
|
||||||
durations = [1, 4, 30, 60]
|
durations = [1, 4, 30, 60]
|
||||||
distances = [100, 500, 1000, 2000, 5000, 6000, 10000, 21097, 42195]
|
distances = [100, 500, 1000, 2000, 5000, 6000, 10000, 21097, 42195]
|
||||||
|
|
||||||
@@ -1320,7 +1279,6 @@ def rankings_view2(request, userid=0,
|
|||||||
if r.birthdate:
|
if r.birthdate:
|
||||||
age = calculate_age(r.birthdate)
|
age = calculate_age(r.birthdate)
|
||||||
else:
|
else:
|
||||||
worldclasspower = None
|
|
||||||
age = 0
|
age = 0
|
||||||
|
|
||||||
agerecords = CalcAgePerformance.objects.filter(
|
agerecords = CalcAgePerformance.objects.filter(
|
||||||
@@ -1393,7 +1351,6 @@ def rankings_view2(request, userid=0,
|
|||||||
try:
|
try:
|
||||||
r = getrower(theuser)
|
r = getrower(theuser)
|
||||||
except Rower.DoesNotExist: # pragma: no cover
|
except Rower.DoesNotExist: # pragma: no cover
|
||||||
allergworkouts = []
|
|
||||||
r = 0
|
r = 0
|
||||||
|
|
||||||
uu = theuser
|
uu = theuser
|
||||||
@@ -1401,7 +1358,6 @@ def rankings_view2(request, userid=0,
|
|||||||
# test to fix bug
|
# test to fix bug
|
||||||
startdate = datetime.datetime.combine(startdate, datetime.time())
|
startdate = datetime.datetime.combine(startdate, datetime.time())
|
||||||
enddate = datetime.datetime.combine(enddate, datetime.time(23, 59, 59))
|
enddate = datetime.datetime.combine(enddate, datetime.time(23, 59, 59))
|
||||||
#enddate = enddate+datetime.timedelta(days=1)
|
|
||||||
startdate = arrow.get(startdate).datetime
|
startdate = arrow.get(startdate).datetime
|
||||||
enddate = arrow.get(enddate).datetime
|
enddate = arrow.get(enddate).datetime
|
||||||
|
|
||||||
@@ -1469,11 +1425,6 @@ def rankings_view2(request, userid=0,
|
|||||||
paulintercept = res[3]
|
paulintercept = res[3]
|
||||||
p1 = res[4]
|
p1 = res[4]
|
||||||
message = res[5]
|
message = res[5]
|
||||||
try:
|
|
||||||
testcalc = pd.Series(res[6], dtype='float')*3
|
|
||||||
except TypeError: # pragma: no cover
|
|
||||||
age = 0
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
script = ''
|
script = ''
|
||||||
div = '<p>No ranking pieces found.</p>'
|
div = '<p>No ranking pieces found.</p>'
|
||||||
@@ -1710,7 +1661,7 @@ def otecp_toadmin_view(request, theuser=0,
|
|||||||
powerdf.drop_duplicates(subset='Delta', keep='first', inplace=True)
|
powerdf.drop_duplicates(subset='Delta', keep='first', inplace=True)
|
||||||
powerdf.to_csv(csvfilename)
|
powerdf.to_csv(csvfilename)
|
||||||
|
|
||||||
res = myqueue(queuehigh,
|
_ = myqueue(queuehigh,
|
||||||
handle_sendemailfile,
|
handle_sendemailfile,
|
||||||
'Sander',
|
'Sander',
|
||||||
'Roosendaal',
|
'Roosendaal',
|
||||||
@@ -1780,7 +1731,7 @@ def otwcp_toadmin_view(request, theuser=0,
|
|||||||
powerdf.drop_duplicates(subset='Delta', keep='first', inplace=True)
|
powerdf.drop_duplicates(subset='Delta', keep='first', inplace=True)
|
||||||
powerdf.to_csv(csvfilename)
|
powerdf.to_csv(csvfilename)
|
||||||
|
|
||||||
res = myqueue(queuehigh,
|
_ = myqueue(queuehigh,
|
||||||
handle_sendemailfile,
|
handle_sendemailfile,
|
||||||
'Sander',
|
'Sander',
|
||||||
'Roosendaal',
|
'Roosendaal',
|
||||||
@@ -1844,11 +1795,6 @@ def agegrouprecordview(request, sex='male', weightcategory='hwt',
|
|||||||
'the_div': div,
|
'the_div': div,
|
||||||
})
|
})
|
||||||
|
|
||||||
# alert overview view
|
|
||||||
# @user_passes_test(ispromember, login_url="/rowers/paidplans",
|
|
||||||
# message="This functionality requires a Pro plan or higher. If you are already a Pro user, please log in to access this functionality",
|
|
||||||
# redirect_field_name=None)
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('rower.is_coach', fn=get_user_by_userid, raise_exception=True)
|
@permission_required('rower.is_coach', fn=get_user_by_userid, raise_exception=True)
|
||||||
@@ -1885,7 +1831,8 @@ def alerts_view(request, userid=0):
|
|||||||
|
|
||||||
|
|
||||||
@user_passes_test(ispromember, login_url="/rowers/paidplans",
|
@user_passes_test(ispromember, login_url="/rowers/paidplans",
|
||||||
message="This functionality requires a Pro plan or higher. If you are already a Pro user, please log in to access this functionality",
|
message="This functionality requires a Pro plan or higher."
|
||||||
|
" If you are already a Pro user, please log in to access this functionality",
|
||||||
redirect_field_name=None)
|
redirect_field_name=None)
|
||||||
@permission_required('rower.is_coach', fn=get_user_by_userid, raise_exception=True)
|
@permission_required('rower.is_coach', fn=get_user_by_userid, raise_exception=True)
|
||||||
def alert_create_view(request, userid=0):
|
def alert_create_view(request, userid=0):
|
||||||
@@ -1926,7 +1873,8 @@ def alert_create_view(request, userid=0):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
result, message = create_alert(request.user, r, measured, period=period, emailalert=emailalert,
|
result, message = create_alert(request.user, r, measured,
|
||||||
|
period=period, emailalert=emailalert,
|
||||||
reststrokes=reststrokes, workouttype=workouttype,
|
reststrokes=reststrokes, workouttype=workouttype,
|
||||||
boattype=boattype,
|
boattype=boattype,
|
||||||
filter=filters,
|
filter=filters,
|
||||||
@@ -2027,7 +1975,8 @@ def alert_report_view(request, id=0, userid=0, nperiod=0):
|
|||||||
|
|
||||||
|
|
||||||
@user_passes_test(ispromember, login_url="/rowers/paidplans",
|
@user_passes_test(ispromember, login_url="/rowers/paidplans",
|
||||||
message="This functionality requires a Pro plan or higher. If you are already a Pro user, please log in to access this functionality",
|
message="This functionality requires a Pro plan or higher."
|
||||||
|
" If you are already a Pro user, please log in to access this functionality",
|
||||||
redirect_field_name=None)
|
redirect_field_name=None)
|
||||||
@permission_required('rower.is_coach', fn=get_user_by_userid, raise_exception=True)
|
@permission_required('rower.is_coach', fn=get_user_by_userid, raise_exception=True)
|
||||||
def alert_edit_view(request, id=0, userid=0):
|
def alert_edit_view(request, id=0, userid=0):
|
||||||
@@ -2100,7 +2049,7 @@ def alert_edit_view(request, id=0, userid=0):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
res = alert_add_filters(alert, filters)
|
_ = alert_add_filters(alert, filters)
|
||||||
messages.info(request, 'Alert was changed')
|
messages.info(request, 'Alert was changed')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@@ -2193,7 +2142,8 @@ class AlertDelete(DeleteView):
|
|||||||
|
|
||||||
|
|
||||||
@user_passes_test(ispromember, login_url="/rowers/paidplans",
|
@user_passes_test(ispromember, login_url="/rowers/paidplans",
|
||||||
message="This functionality requires a Pro plan or higher. If you are already a Pro user, please log in to access this functionality",
|
message="This functionality requires a Pro plan or higher."
|
||||||
|
" If you are already a Pro user, please log in to access this functionality",
|
||||||
redirect_field_name=None)
|
redirect_field_name=None)
|
||||||
@permission_required('rower.is_coach', fn=get_user_by_userid, raise_exception=True)
|
@permission_required('rower.is_coach', fn=get_user_by_userid, raise_exception=True)
|
||||||
def history_view(request, userid=0):
|
def history_view(request, userid=0):
|
||||||
@@ -2246,10 +2196,6 @@ def history_view(request, userid=0):
|
|||||||
privacy='visible'
|
privacy='visible'
|
||||||
).order_by("-startdatetime")
|
).order_by("-startdatetime")
|
||||||
|
|
||||||
ids = [w.id for w in g_workouts]
|
|
||||||
|
|
||||||
columns = ['hr', 'power', 'time']
|
|
||||||
|
|
||||||
tscript, tdiv = interactive_workouttype_piechart(g_workouts)
|
tscript, tdiv = interactive_workouttype_piechart(g_workouts)
|
||||||
|
|
||||||
totalmeters, totalhours, totalminutes, totalseconds = get_totals(
|
totalmeters, totalhours, totalminutes, totalseconds = get_totals(
|
||||||
|
|||||||
Reference in New Issue
Block a user