Merge branch 'release/v16.0.3'
This commit is contained in:
@@ -997,44 +997,6 @@ def updatecpdata_sql(rower_id,delta,cp,table='cpdata',distance=[]):
|
|||||||
conn.close()
|
conn.close()
|
||||||
engine.dispose()
|
engine.dispose()
|
||||||
|
|
||||||
|
|
||||||
def runcpupdate(
|
|
||||||
rower,type='water',
|
|
||||||
startdate=timezone.now()-datetime.timedelta(days=365),
|
|
||||||
enddate=timezone.now()+datetime.timedelta(days=5)
|
|
||||||
):
|
|
||||||
if type == 'water':
|
|
||||||
theworkouts = Workout.objects.filter(
|
|
||||||
user=rower,rankingpiece=True,
|
|
||||||
workouttype='water',
|
|
||||||
startdatetime__gte=startdate,
|
|
||||||
startdatetime__lte=enddate
|
|
||||||
)
|
|
||||||
table = 'cpdata'
|
|
||||||
else:
|
|
||||||
theworkouts = Workout.objects.filter(
|
|
||||||
user=rower,rankingpiece=True,
|
|
||||||
workouttype__in=[
|
|
||||||
'rower',
|
|
||||||
'dynamic',
|
|
||||||
'slides'
|
|
||||||
],
|
|
||||||
startdatetime__gte=startdate,
|
|
||||||
startdatetime__lte=enddate
|
|
||||||
)
|
|
||||||
table = 'cpergdata'
|
|
||||||
|
|
||||||
theids = [w.id for w in theworkouts]
|
|
||||||
|
|
||||||
job = myqueue(
|
|
||||||
queuelow,
|
|
||||||
handle_updatecp,
|
|
||||||
rower.id,
|
|
||||||
theids,
|
|
||||||
table=table)
|
|
||||||
|
|
||||||
return job
|
|
||||||
|
|
||||||
def fetchcperg(rower,theworkouts):
|
def fetchcperg(rower,theworkouts):
|
||||||
theids = [int(w.id) for w in theworkouts]
|
theids = [int(w.id) for w in theworkouts]
|
||||||
thefilenames = [w.csvfilename for w in theworkouts]
|
thefilenames = [w.csvfilename for w in theworkouts]
|
||||||
|
|||||||
@@ -4577,18 +4577,18 @@ def interactive_cum_flex_chart2(theworkouts,promember=0,
|
|||||||
|
|
||||||
# test if we have drive energy
|
# test if we have drive energy
|
||||||
nowork = 1
|
nowork = 1
|
||||||
try:
|
try: # pragma: no cover
|
||||||
test = datadf['driveenergy'].mean()
|
test = datadf['driveenergy'].mean()
|
||||||
nowork = 0
|
nowork = 0
|
||||||
except KeyError:
|
except KeyError: # pragma: no cover
|
||||||
datadf['driveenergy'] = 500.
|
datadf['driveenergy'] = 500.
|
||||||
|
|
||||||
# test if we have power
|
# test if we have power
|
||||||
nopower = 1
|
nopower = 1
|
||||||
try:
|
try: # pragma: no cover
|
||||||
test = datadf['power'].mean()
|
test = datadf['power'].mean()
|
||||||
nopower = 0
|
nopower = 0
|
||||||
except KeyError:
|
except KeyError: # pragma: no cover
|
||||||
datadf['power'] = 50.
|
datadf['power'] = 50.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -106,8 +106,7 @@ def make_new_workout_from_email(rower, datafile, name, cntr=0,testing=False):
|
|||||||
path='media/')[6:]
|
path='media/')[6:]
|
||||||
fileformat = fileformat[2]
|
fileformat = fileformat[2]
|
||||||
|
|
||||||
if testing:
|
|
||||||
print('Fileformat = ',fileformat)
|
|
||||||
|
|
||||||
|
|
||||||
f,e = os.path.splitext(datafilename)
|
f,e = os.path.splitext(datafilename)
|
||||||
|
|||||||
@@ -65,8 +65,6 @@ def processattachment(rower, fileobj, title, uploadoptions,testing=False):
|
|||||||
# filename = os.path.abspath(fileobj.name)
|
# filename = os.path.abspath(fileobj.name)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
filename = fileobj[6:]
|
filename = fileobj[6:]
|
||||||
if testing:
|
|
||||||
print('Attribute Error', filename)
|
|
||||||
|
|
||||||
|
|
||||||
# test if file exists and is not empty
|
# test if file exists and is not empty
|
||||||
@@ -74,12 +72,8 @@ def processattachment(rower, fileobj, title, uploadoptions,testing=False):
|
|||||||
with io.open('media/'+filename,'rb') as fop:
|
with io.open('media/'+filename,'rb') as fop:
|
||||||
line = fop.readline()
|
line = fop.readline()
|
||||||
except (IOError, UnicodeEncodeError):
|
except (IOError, UnicodeEncodeError):
|
||||||
if testing:
|
|
||||||
print('IOError',filename,'media/'+filename)
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if testing:
|
|
||||||
print('Creating workout from email')
|
|
||||||
|
|
||||||
# set user
|
# set user
|
||||||
if rower.user.is_staff and 'username' in uploadoptions:
|
if rower.user.is_staff and 'username' in uploadoptions:
|
||||||
@@ -134,8 +128,6 @@ def processattachment(rower, fileobj, title, uploadoptions,testing=False):
|
|||||||
except VirtualRace.DoesNotExist:
|
except VirtualRace.DoesNotExist:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if testing:
|
|
||||||
print('Workout id = {workoutid}'.format(workoutid=workoutid))
|
|
||||||
|
|
||||||
return workoutid
|
return workoutid
|
||||||
|
|
||||||
@@ -281,15 +273,6 @@ class Command(BaseCommand):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
# move attachment and make workout
|
# move attachment and make workout
|
||||||
if testing:
|
|
||||||
try:
|
|
||||||
print(name)
|
|
||||||
except UnicodeEncodeError:
|
|
||||||
print("Unicode Error")
|
|
||||||
try:
|
|
||||||
print(attachment.document)
|
|
||||||
except UnicodeEncodeError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
workoutid = processattachment(
|
workoutid = processattachment(
|
||||||
rower, attachment.document, name, uploadoptions,
|
rower, attachment.document, name, uploadoptions,
|
||||||
|
|||||||
+15
-4
@@ -269,6 +269,7 @@ def get_workout(user,nkid):
|
|||||||
|
|
||||||
# get strokes
|
# get strokes
|
||||||
url = NK_API_LOCATION+"api/v1/sessions/strokes"
|
url = NK_API_LOCATION+"api/v1/sessions/strokes"
|
||||||
|
|
||||||
response = requests.get(url,headers=headers,params=params)
|
response = requests.get(url,headers=headers,params=params)
|
||||||
|
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
@@ -282,13 +283,22 @@ def get_workout(user,nkid):
|
|||||||
df = strokeDataToDf(strokeData)
|
df = strokeDataToDf(strokeData)
|
||||||
|
|
||||||
# get workout data
|
# get workout data
|
||||||
timestampbegin = df['timestamp'].min()
|
after = df['timestamp'].min()
|
||||||
timestampend = df['timestamp'].max()
|
before = df['timestamp'].max()
|
||||||
|
|
||||||
|
after = arrow.get(after/1000.)
|
||||||
|
before = arrow.get(before/1000.)
|
||||||
|
after = after-timedelta(days=1)
|
||||||
|
before = before+timedelta(days=1)
|
||||||
|
before = str(int(before.timestamp())*1000)
|
||||||
|
after = str(int(after.timestamp())*1000)
|
||||||
|
print(after)
|
||||||
|
|
||||||
|
|
||||||
url = NK_API_LOCATION+"api/v1/sessions/"
|
url = NK_API_LOCATION+"api/v1/sessions/"
|
||||||
params = {
|
params = {
|
||||||
'after':timestampbegin-1,
|
'after':after,
|
||||||
'before': timestampend+1,
|
'before': before,
|
||||||
}
|
}
|
||||||
|
|
||||||
response = requests.get(url, headers=headers,params=params)
|
response = requests.get(url, headers=headers,params=params)
|
||||||
@@ -299,6 +309,7 @@ def get_workout(user,nkid):
|
|||||||
|
|
||||||
jsondata = response.json()
|
jsondata = response.json()
|
||||||
workoutdata = {}
|
workoutdata = {}
|
||||||
|
|
||||||
for w in jsondata:
|
for w in jsondata:
|
||||||
if str(w['id']) == str(nkid):
|
if str(w['id']) == str(nkid):
|
||||||
workoutdata = w
|
workoutdata = w
|
||||||
|
|||||||
@@ -177,8 +177,6 @@ def set_strava_athlete_id(user):
|
|||||||
r.strava_owner_id = response.json()['id']
|
r.strava_owner_id = response.json()['id']
|
||||||
r.save()
|
r.save()
|
||||||
return response.json()['id']
|
return response.json()['id']
|
||||||
else:
|
|
||||||
print(response)
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -775,7 +773,7 @@ def workout_strava_upload(user,w, quick=False,asynchron=True):
|
|||||||
activity_type = mytypes.stravamapping[w.workouttype]
|
activity_type = mytypes.stravamapping[w.workouttype]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
activity_type = 'Rowing'
|
activity_type = 'Rowing'
|
||||||
print(w.workouttype,activity_type)
|
|
||||||
with open(tcxfile,'rb') as f:
|
with open(tcxfile,'rb') as f:
|
||||||
res,mes = handle_stravaexport(
|
res,mes = handle_stravaexport(
|
||||||
f,w.name,
|
f,w.name,
|
||||||
|
|||||||
+186
-259
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,7 @@
|
|||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<p>Are you sure you want to delete <em>{{ object }}</em>?</p>
|
<p>Are you sure you want to delete <em>{{ object }}</em>?</p>
|
||||||
<input class="button red" type="submit" value="Confirm">
|
<input class="button" type="submit" value="Confirm">
|
||||||
</form>
|
</form>
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
+80
-4
@@ -165,6 +165,70 @@ def mocked_sqlalchemy(*args, **kwargs):
|
|||||||
|
|
||||||
return MockEngine()
|
return MockEngine()
|
||||||
|
|
||||||
|
from rowers import courses
|
||||||
|
|
||||||
|
def mocked_sqlalchemy_courses(*args, **kwargs):
|
||||||
|
# return object with method
|
||||||
|
cs = courses.kmltocourse('rowers/tests/testdata/thyro.kml')
|
||||||
|
course = cs[0]
|
||||||
|
cname = course['name']
|
||||||
|
cnotes = course['description']
|
||||||
|
polygons = course['polygons']
|
||||||
|
|
||||||
|
lijst = []
|
||||||
|
i=0
|
||||||
|
for polygon in polygons:
|
||||||
|
lijst.append((i,polygon['name']))
|
||||||
|
i = i+1
|
||||||
|
|
||||||
|
puntenlijst = []
|
||||||
|
i = 0
|
||||||
|
for p in polygons[0]['points']:
|
||||||
|
puntenlijst.append((i,p['latitude'],p['longitude']))
|
||||||
|
i = i+1
|
||||||
|
|
||||||
|
|
||||||
|
class MockEngine:
|
||||||
|
def connect(self):
|
||||||
|
return MockConnection()
|
||||||
|
|
||||||
|
def dispose(self):
|
||||||
|
return True
|
||||||
|
|
||||||
|
def raw_connection(self):
|
||||||
|
return True
|
||||||
|
|
||||||
|
class QueryResultPolygons:
|
||||||
|
def fetchall(self):
|
||||||
|
return lijst
|
||||||
|
|
||||||
|
class QueryResultPoints:
|
||||||
|
def fetchall(self):
|
||||||
|
return puntenlijst
|
||||||
|
|
||||||
|
class MockConnection:
|
||||||
|
def begin(self):
|
||||||
|
return True
|
||||||
|
|
||||||
|
def execute(self,query):
|
||||||
|
if 'latitude' in query:
|
||||||
|
return QueryResultPoints()
|
||||||
|
if 'polygon' in query:
|
||||||
|
return QueryResultPolygons()
|
||||||
|
return True
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
return True
|
||||||
|
|
||||||
|
def __exit__(self, *args, **kwargs):
|
||||||
|
return True
|
||||||
|
|
||||||
|
def __enter__(self, *args, **kwargs):
|
||||||
|
return True
|
||||||
|
|
||||||
|
return MockEngine()
|
||||||
|
|
||||||
|
|
||||||
#@pytest.mark.django_db
|
#@pytest.mark.django_db
|
||||||
class DjangoTestCase(TestCase): #, MockTestCase):
|
class DjangoTestCase(TestCase): #, MockTestCase):
|
||||||
def _pre_setup(self):
|
def _pre_setup(self):
|
||||||
@@ -349,9 +413,16 @@ def mocked_cpraw(*args, **kwargs):
|
|||||||
|
|
||||||
return df
|
return df
|
||||||
|
|
||||||
def StravaActivity():
|
class StravalibResponse():
|
||||||
|
def __init__(self,*args, **kwargs):
|
||||||
|
self.id = 1
|
||||||
|
|
||||||
|
class StravaActivity():
|
||||||
def wait(*args, **kwargs):
|
def wait(*args, **kwargs):
|
||||||
return 1
|
return StravalibResponse()
|
||||||
|
|
||||||
|
def __init__(*args, **kwargs):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -362,6 +433,9 @@ class MockStravalibClient():
|
|||||||
def update_activity(*args, **kwargs):
|
def update_activity(*args, **kwargs):
|
||||||
return StravaActivity()
|
return StravaActivity()
|
||||||
|
|
||||||
|
def __init__(*args,**kwargs):
|
||||||
|
pass
|
||||||
|
|
||||||
# Mocked Braintree
|
# Mocked Braintree
|
||||||
|
|
||||||
## Higher level - unfortunately didn't succeed in mocking the gateway
|
## Higher level - unfortunately didn't succeed in mocking the gateway
|
||||||
@@ -791,6 +865,7 @@ def mocked_requests(*args, **kwargs):
|
|||||||
nkstrokesregex = '.*?nkrowlink\.com\/api\/v1\/sessions\/strokes'
|
nkstrokesregex = '.*?nkrowlink\.com\/api\/v1\/sessions\/strokes'
|
||||||
nkstrokestester = re.compile(nkstrokesregex)
|
nkstrokestester = re.compile(nkstrokesregex)
|
||||||
|
|
||||||
|
|
||||||
stravaathleteregex = '.*?strava\.com\/api\/v3\/athlete$'
|
stravaathleteregex = '.*?strava\.com\/api\/v3\/athlete$'
|
||||||
stravaathletetester = re.compile(stravaathleteregex)
|
stravaathletetester = re.compile(stravaathleteregex)
|
||||||
|
|
||||||
@@ -957,7 +1032,6 @@ def mocked_requests(*args, **kwargs):
|
|||||||
|
|
||||||
|
|
||||||
if nktester.match(args[0]):
|
if nktester.match(args[0]):
|
||||||
|
|
||||||
if 'token' in args[0]:
|
if 'token' in args[0]:
|
||||||
json_data = {
|
json_data = {
|
||||||
'access_token': 'TA3n1vrNjuQJWw0TdCDHnjSmrjIPULhTlejMIWqq',
|
'access_token': 'TA3n1vrNjuQJWw0TdCDHnjSmrjIPULhTlejMIWqq',
|
||||||
@@ -967,12 +1041,14 @@ def mocked_requests(*args, **kwargs):
|
|||||||
return MockResponse(json_data,200)
|
return MockResponse(json_data,200)
|
||||||
if nkstrokestester.match(args[0]):
|
if nkstrokestester.match(args[0]):
|
||||||
params = kwargs.pop('params',{})
|
params = kwargs.pop('params',{})
|
||||||
|
|
||||||
if 'sessionIds' in params and params['sessionIds'] == '404':
|
if 'sessionIds' in params and params['sessionIds'] == '404':
|
||||||
return MockResponse(nkimpellerstrokedata, 200)
|
return MockResponse(nkimpellerstrokedata, 200)
|
||||||
return MockResponse(nkstrokedata,200)
|
return MockResponse(nkstrokedata,200)
|
||||||
if nkworkoutlisttester.match(args[0]):
|
if nkworkoutlisttester.match(args[0]):
|
||||||
params = kwargs.pop('params',{})
|
params = kwargs.pop('params',{})
|
||||||
if 'after' in params and params['after'] == 1267136372998:
|
|
||||||
|
if 'after' in params and params['after'] == '1267049972000':
|
||||||
return MockResponse(nkimpellerworkoutlist,200)
|
return MockResponse(nkimpellerworkoutlist,200)
|
||||||
return MockResponse(nkworkoutlist,200)
|
return MockResponse(nkworkoutlist,200)
|
||||||
|
|
||||||
|
|||||||
+123
-474
@@ -75,104 +75,6 @@ class WorkoutCompareTest(TestCase):
|
|||||||
self.assertEqual(response.status_code,200)
|
self.assertEqual(response.status_code,200)
|
||||||
|
|
||||||
|
|
||||||
class BoxPlotTest(TestCase):
|
|
||||||
def setUp(self):
|
|
||||||
self.u = UserFactory()
|
|
||||||
|
|
||||||
self.r = Rower.objects.create(user=self.u,
|
|
||||||
birthdate=faker.profile()['birthdate'],
|
|
||||||
gdproptin=True,surveydone=True,
|
|
||||||
gdproptindate=timezone.now(),
|
|
||||||
rowerplan='coach')
|
|
||||||
|
|
||||||
self.c = Client()
|
|
||||||
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
|
|
||||||
|
|
||||||
self.factory = RequestFactory()
|
|
||||||
self.password = faker.word()
|
|
||||||
self.u.set_password(self.password)
|
|
||||||
self.u.save()
|
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
for workout in self.user_workouts:
|
|
||||||
try:
|
|
||||||
os.remove(workout.csvfilename)
|
|
||||||
except (IOError, FileNotFoundError,OSError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@patch('rowers.dataprep.create_engine')
|
|
||||||
@patch('rowers.dataprep.getsmallrowdata_db')
|
|
||||||
def test_workouts_boxplot(self, mocked_sqlalchemy,
|
|
||||||
mocked_getsmallrowdata_db):
|
|
||||||
|
|
||||||
login = self.c.login(username=self.u.username, password=self.password)
|
|
||||||
self.assertTrue(login)
|
|
||||||
|
|
||||||
url = '/rowers/user-boxplot-select/'
|
|
||||||
|
|
||||||
response = self.c.get(url)
|
|
||||||
self.assertEqual(response.status_code,200)
|
|
||||||
|
|
||||||
@patch('rowers.dataprep.create_engine')
|
|
||||||
@patch('rowers.dataprep.getsmallrowdata_db')
|
|
||||||
@patch('rowers.dataprep.read_cols_df_sql', side_effect = mocked_read_df_cols_sql_multi)
|
|
||||||
def donot_test_workouts_boxplot_submit(self, mocked_sqlalchemy,
|
|
||||||
mocked_getsmallrowdata_db,
|
|
||||||
mocked_df):
|
|
||||||
|
|
||||||
login = self.c.login(username=self.u.username,password=self.password)
|
|
||||||
self.assertTrue(login)
|
|
||||||
|
|
||||||
form_data = {
|
|
||||||
'workouts':['1','2','3'],
|
|
||||||
'includereststrokes':False,
|
|
||||||
'spmmax':55.0,
|
|
||||||
'spmmin':15.0,
|
|
||||||
'workmax':1500.0,
|
|
||||||
'workmin':0.0,
|
|
||||||
'yparam':'spm',
|
|
||||||
}
|
|
||||||
|
|
||||||
form = WorkoutMultipleCompareForm(form_data)
|
|
||||||
chartform = BoxPlotChoiceForm(form_data)
|
|
||||||
|
|
||||||
self.assertTrue(form.is_valid())
|
|
||||||
self.assertTrue(chartform.is_valid())
|
|
||||||
|
|
||||||
response = self.c.get('/rowers/user-boxplot/',follow=True)
|
|
||||||
self.assertEqual(response.status_code,200)
|
|
||||||
self.assertRedirects(response,
|
|
||||||
expected_url='/rowers/user-boxplot-select/user/1/',
|
|
||||||
status_code=302,target_status_code=200)
|
|
||||||
|
|
||||||
response = self.c.post('/rowers/user-boxplot/',form_data)
|
|
||||||
|
|
||||||
self.assertEqual(response.status_code,200)
|
|
||||||
|
|
||||||
options = {}
|
|
||||||
options['spmmin'] = 15
|
|
||||||
options['spmmax'] = 55
|
|
||||||
options['workmin'] = 0
|
|
||||||
options['workmax'] = 5500
|
|
||||||
options['ids'] = [1,2,3]
|
|
||||||
options['userid'] = 1
|
|
||||||
options['plotfield'] = 'spm'
|
|
||||||
options['rankingonly'] = False
|
|
||||||
options['cpfit'] = 'data'
|
|
||||||
options['piece'] = 4
|
|
||||||
|
|
||||||
session = self.c.session
|
|
||||||
session['options'] = options
|
|
||||||
session.save()
|
|
||||||
response = self.c.get('/')
|
|
||||||
|
|
||||||
sessionoptions = session['options']
|
|
||||||
self.assertEqual(sessionoptions['ids'],[1,2,3])
|
|
||||||
|
|
||||||
response = self.c.get('/rowers/user-boxplot-data/')
|
|
||||||
|
|
||||||
|
|
||||||
self.assertEqual(response.status_code,200)
|
|
||||||
|
|
||||||
|
|
||||||
class ListWorkoutTest(TestCase):
|
class ListWorkoutTest(TestCase):
|
||||||
@@ -316,382 +218,6 @@ class ForcecurveTest(TestCase):
|
|||||||
response = self.c.get(url)
|
response = self.c.get(url)
|
||||||
self.assertEqual(response.status_code,200)
|
self.assertEqual(response.status_code,200)
|
||||||
|
|
||||||
class CumStatsTest(TestCase):
|
|
||||||
def setUp(self):
|
|
||||||
self.u = UserFactory()
|
|
||||||
|
|
||||||
self.r = Rower.objects.create(user=self.u,
|
|
||||||
birthdate=faker.profile()['birthdate'],
|
|
||||||
gdproptin=True,surveydone=True,
|
|
||||||
gdproptindate=timezone.now(),
|
|
||||||
rowerplan='coach')
|
|
||||||
|
|
||||||
self.c = Client()
|
|
||||||
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
|
|
||||||
self.factory = RequestFactory()
|
|
||||||
self.password = faker.word()
|
|
||||||
self.u.set_password(self.password)
|
|
||||||
self.u.save()
|
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
for workout in self.user_workouts:
|
|
||||||
try:
|
|
||||||
os.remove(workout.csvfilename)
|
|
||||||
except (IOError, FileNotFoundError,OSError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@patch('rowers.dataprep.read_cols_df_sql', side_effect = mocked_read_df_cols_sql_multistats)
|
|
||||||
def test_cumstats(self, mocked_df):
|
|
||||||
login = self.c.login(username=self.u.username, password=self.password)
|
|
||||||
self.assertTrue(login)
|
|
||||||
|
|
||||||
startdate = (self.user_workouts[0].startdatetime-datetime.timedelta(days=3)).date()
|
|
||||||
enddate = (self.user_workouts[0].startdatetime+datetime.timedelta(days=3)).date()
|
|
||||||
|
|
||||||
# make sure the dates are not naive
|
|
||||||
try:
|
|
||||||
startdate = pytz.utc.localize(startdate)
|
|
||||||
except (ValueError, AttributeError):
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
enddate = pytz.utc.localize(enddate)
|
|
||||||
except (ValueError, AttributeError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
url = '/rowers/cumstats/'
|
|
||||||
response = self.c.get(url)
|
|
||||||
|
|
||||||
self.assertEqual(response.status_code,200)
|
|
||||||
|
|
||||||
class CumFlexTest(TestCase):
|
|
||||||
def setUp(self):
|
|
||||||
self.u = UserFactory()
|
|
||||||
|
|
||||||
self.r = Rower.objects.create(user=self.u,
|
|
||||||
birthdate=faker.profile()['birthdate'],
|
|
||||||
gdproptin=True,surveydone=True,
|
|
||||||
gdproptindate=timezone.now(),
|
|
||||||
rowerplan='coach')
|
|
||||||
|
|
||||||
self.c = Client()
|
|
||||||
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
|
|
||||||
self.factory = RequestFactory()
|
|
||||||
self.password = faker.word()
|
|
||||||
self.u.set_password(self.password)
|
|
||||||
self.u.save()
|
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
for workout in self.user_workouts:
|
|
||||||
try:
|
|
||||||
os.remove(workout.csvfilename)
|
|
||||||
except (IOError, FileNotFoundError,OSError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@patch('rowers.dataprep.read_cols_df_sql', side_effect = mocked_read_df_cols_sql_multiflex)
|
|
||||||
def test_cumflex(self, mocked_df):
|
|
||||||
login = self.c.login(username=self.u.username, password=self.password)
|
|
||||||
self.assertTrue(login)
|
|
||||||
|
|
||||||
startdate = (self.user_workouts[0].startdatetime-datetime.timedelta(days=3)).date()
|
|
||||||
enddate = (self.user_workouts[0].startdatetime+datetime.timedelta(days=3)).date()
|
|
||||||
|
|
||||||
# make sure the dates are not naive
|
|
||||||
try:
|
|
||||||
startdate = pytz.utc.localize(startdate)
|
|
||||||
except (ValueError, AttributeError):
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
enddate = pytz.utc.localize(enddate)
|
|
||||||
except (ValueError, AttributeError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
waterboattype = [u'1x',
|
|
||||||
u'2x',
|
|
||||||
u'2x+',
|
|
||||||
u'2-',
|
|
||||||
u'2+',
|
|
||||||
u'3x+',
|
|
||||||
u'3x-',
|
|
||||||
u'4x',
|
|
||||||
u'4x+',
|
|
||||||
u'4-',
|
|
||||||
u'4+',
|
|
||||||
u'8+',
|
|
||||||
u'8x+']
|
|
||||||
|
|
||||||
form_data = {
|
|
||||||
'startdate':startdate,
|
|
||||||
'enddate':enddate,
|
|
||||||
'modality':u'all',
|
|
||||||
'waterboattype': waterboattype,
|
|
||||||
'xaxis':'spm',
|
|
||||||
'yaxis1':'hr',
|
|
||||||
'yaxis2':'power',
|
|
||||||
}
|
|
||||||
|
|
||||||
form = TrendFlexModalForm(form_data)
|
|
||||||
self.assertTrue(form.is_valid())
|
|
||||||
|
|
||||||
self.factory.user = self.u
|
|
||||||
form = FlexAxesForm(self.factory,form_data)
|
|
||||||
|
|
||||||
|
|
||||||
url = '/rowers/flexall/'
|
|
||||||
|
|
||||||
response = self.c.get(url)
|
|
||||||
self.assertEqual(response.status_code,200)
|
|
||||||
|
|
||||||
response = self.c.post(url, form_data)
|
|
||||||
self.assertEqual(response.status_code,200)
|
|
||||||
|
|
||||||
|
|
||||||
options = {'enddatestring': '2019-01-14',
|
|
||||||
'includereststrokes': False,
|
|
||||||
'modality': u'water',
|
|
||||||
'rankingonly': False,
|
|
||||||
'startdatestring': '2018-12-15',
|
|
||||||
'theuser': 2,
|
|
||||||
'waterboattype': [u'1x',
|
|
||||||
u'2x',
|
|
||||||
u'2x+',
|
|
||||||
u'2-',
|
|
||||||
u'2+',
|
|
||||||
u'3x+',
|
|
||||||
u'3x-',
|
|
||||||
u'4x',
|
|
||||||
u'4x+',
|
|
||||||
u'4-',
|
|
||||||
u'4+',
|
|
||||||
u'8+',
|
|
||||||
u'8x+'],
|
|
||||||
'xparam': u'spm',
|
|
||||||
'yparam1': u'hr',
|
|
||||||
'yparam2': u'power'}
|
|
||||||
|
|
||||||
session = self.c.session
|
|
||||||
session['options'] = options
|
|
||||||
session.save()
|
|
||||||
response = self.c.get('/')
|
|
||||||
|
|
||||||
url = '/rowers/flexalldata/'
|
|
||||||
response = self.c.get(url)
|
|
||||||
self.assertEqual(response.status_code, 200)
|
|
||||||
|
|
||||||
|
|
||||||
class MultiFlexTest(TestCase):
|
|
||||||
def setUp(self):
|
|
||||||
self.u = UserFactory()
|
|
||||||
|
|
||||||
self.r = Rower.objects.create(user=self.u,
|
|
||||||
birthdate=faker.profile()['birthdate'],
|
|
||||||
gdproptin=True,surveydone=True,
|
|
||||||
gdproptindate=timezone.now(),
|
|
||||||
rowerplan='coach')
|
|
||||||
|
|
||||||
self.c = Client()
|
|
||||||
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
|
|
||||||
self.factory = RequestFactory()
|
|
||||||
self.password = faker.word()
|
|
||||||
self.u.set_password(self.password)
|
|
||||||
self.u.save()
|
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
for workout in self.user_workouts:
|
|
||||||
try:
|
|
||||||
os.remove(workout.csvfilename)
|
|
||||||
except (IOError, FileNotFoundError,OSError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@patch('rowers.dataprep.read_cols_df_sql', side_effect = mocked_read_df_cols_sql_multiflex)
|
|
||||||
def test_multiflex(self, mocked_df):
|
|
||||||
login = self.c.login(username=self.u.username, password=self.password)
|
|
||||||
self.assertTrue(login)
|
|
||||||
|
|
||||||
startdate = (self.user_workouts[0].startdatetime-datetime.timedelta(days=3)).date()
|
|
||||||
enddate = (self.user_workouts[0].startdatetime+datetime.timedelta(days=3)).date()
|
|
||||||
|
|
||||||
# make sure the dates are not naive
|
|
||||||
try:
|
|
||||||
startdate = pytz.utc.localize(startdate)
|
|
||||||
except (ValueError, AttributeError):
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
enddate = pytz.utc.localize(enddate)
|
|
||||||
except (ValueError, AttributeError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
waterboattype = [u'1x',
|
|
||||||
u'2x',
|
|
||||||
u'2x+',
|
|
||||||
u'2-',
|
|
||||||
u'2+',
|
|
||||||
u'3x+',
|
|
||||||
u'3x-',
|
|
||||||
u'4x',
|
|
||||||
u'4x+',
|
|
||||||
u'4-',
|
|
||||||
u'4+',
|
|
||||||
u'8+',
|
|
||||||
u'8x+']
|
|
||||||
|
|
||||||
form_data = {
|
|
||||||
'startdate':startdate,
|
|
||||||
'enddate':enddate,
|
|
||||||
'modality':u'all',
|
|
||||||
'waterboattype': waterboattype,
|
|
||||||
'binsize':u'1',
|
|
||||||
'palette':u'monochrome_blue',
|
|
||||||
'spmmax':55,
|
|
||||||
'spmmin':15,
|
|
||||||
'workmax':1500,
|
|
||||||
'workmin':0,
|
|
||||||
'workouts':[1,2,3,4,5],
|
|
||||||
'workoutselectform':'Create Chart',
|
|
||||||
'xparam':'spm',
|
|
||||||
'yparam':'power',
|
|
||||||
'groupby':'spm',
|
|
||||||
}
|
|
||||||
|
|
||||||
form = MultiFlexChoiceForm(form_data)
|
|
||||||
self.assertTrue(form.is_valid())
|
|
||||||
|
|
||||||
url = '/rowers/user-multiflex-select/'
|
|
||||||
|
|
||||||
response = self.c.get(url)
|
|
||||||
self.assertEqual(response.status_code,200)
|
|
||||||
|
|
||||||
url = '/rowers/user-multiflex/user/1/'
|
|
||||||
reponse = self.c.post(url, form_data,follow=True)
|
|
||||||
self.assertEqual(response.status_code, 200)
|
|
||||||
|
|
||||||
options={
|
|
||||||
'includereststrokes':False,
|
|
||||||
'ploterrorbars':True,
|
|
||||||
'userid':0,
|
|
||||||
'palette': 'monochrome_blue',
|
|
||||||
'groupby': 'power',
|
|
||||||
'binsize': 1,
|
|
||||||
'xparam': 'spm',
|
|
||||||
'yparam': 'power',
|
|
||||||
'spmmin': 15,
|
|
||||||
'spmmax': 55,
|
|
||||||
'workmin': 400,
|
|
||||||
'workmax': 1500,
|
|
||||||
'ids': [1,2,3,4,5],
|
|
||||||
'ploterrorbars':False,
|
|
||||||
}
|
|
||||||
|
|
||||||
session = self.c.session
|
|
||||||
session['options'] = options
|
|
||||||
session.save()
|
|
||||||
response = self.c.get('/')
|
|
||||||
|
|
||||||
url = '/rowers/user-multiflex-data/'
|
|
||||||
response = self.c.get(url)
|
|
||||||
self.assertEqual(response.status_code, 200)
|
|
||||||
|
|
||||||
class HistoTest(TestCase):
|
|
||||||
def setUp(self):
|
|
||||||
self.u = UserFactory()
|
|
||||||
|
|
||||||
self.r = Rower.objects.create(user=self.u,
|
|
||||||
birthdate=faker.profile()['birthdate'],
|
|
||||||
gdproptin=True,surveydone=True,
|
|
||||||
gdproptindate=timezone.now(),
|
|
||||||
rowerplan='coach')
|
|
||||||
|
|
||||||
self.c = Client()
|
|
||||||
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
|
|
||||||
self.factory = RequestFactory()
|
|
||||||
self.password = faker.word()
|
|
||||||
self.u.set_password(self.password)
|
|
||||||
self.u.save()
|
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
for workout in self.user_workouts:
|
|
||||||
try:
|
|
||||||
os.remove(workout.csvfilename)
|
|
||||||
except (IOError, FileNotFoundError,OSError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@patch('rowers.dataprep.create_engine')
|
|
||||||
@patch('rowers.dataprep.getsmallrowdata_db', side_effect=mocked_getpowerdata_db)
|
|
||||||
def test_histo_workouts(self, mocked_sqlalchemy,
|
|
||||||
mocked_getsmallrowdata_db):
|
|
||||||
|
|
||||||
login = self.c.login(username=self.u.username, password=self.password)
|
|
||||||
self.assertTrue(login)
|
|
||||||
|
|
||||||
startdate = (self.user_workouts[0].startdatetime-datetime.timedelta(days=3)).date()
|
|
||||||
enddate = (self.user_workouts[0].startdatetime+datetime.timedelta(days=3)).date()
|
|
||||||
|
|
||||||
# make sure the dates are not naive
|
|
||||||
try:
|
|
||||||
startdate = pytz.utc.localize(startdate)
|
|
||||||
except (ValueError, AttributeError):
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
enddate = pytz.utc.localize(enddate)
|
|
||||||
except (ValueError, AttributeError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
waterboattype = [u'1x',
|
|
||||||
u'2x',
|
|
||||||
u'2x+',
|
|
||||||
u'2-',
|
|
||||||
u'2+',
|
|
||||||
u'3x+',
|
|
||||||
u'3x-',
|
|
||||||
u'4x',
|
|
||||||
u'4x+',
|
|
||||||
u'4-',
|
|
||||||
u'4+',
|
|
||||||
u'8+',
|
|
||||||
u'8x+']
|
|
||||||
|
|
||||||
form_data = {
|
|
||||||
'startdate':startdate,
|
|
||||||
'enddate':enddate,
|
|
||||||
'modality':u'all',
|
|
||||||
'histoparam':'power',
|
|
||||||
'rankingonly': False,
|
|
||||||
'includereststrokes':False,
|
|
||||||
'workouttypes': ['water'],
|
|
||||||
'waterboattype': waterboattype
|
|
||||||
}
|
|
||||||
|
|
||||||
url = '/rowers/histo/'
|
|
||||||
response = self.c.get(url)
|
|
||||||
self.assertEqual(response.status_code,200)
|
|
||||||
|
|
||||||
response = self.c.post(url, form_data)
|
|
||||||
self.assertEqual(response.status_code,200)
|
|
||||||
|
|
||||||
|
|
||||||
options = {
|
|
||||||
'includereststrokes':False,
|
|
||||||
'rankingonly':False,
|
|
||||||
'modality':'all',
|
|
||||||
'waterboattype':waterboattype,
|
|
||||||
'theuser':0,
|
|
||||||
'enddatestring':enddate.strftime("%Y-%m-%d"),
|
|
||||||
'startdatestring':startdate.strftime("%Y-%m-%d"),
|
|
||||||
}
|
|
||||||
|
|
||||||
session = self.c.session
|
|
||||||
session['options'] = options
|
|
||||||
session.save()
|
|
||||||
response = self.c.get('/')
|
|
||||||
|
|
||||||
sessionoptions = session['options']
|
|
||||||
|
|
||||||
response = self.c.get('/rowers/histodata/')
|
|
||||||
self.assertEqual(response.status_code,200)
|
|
||||||
|
|
||||||
|
|
||||||
#--------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class WorkoutCompareTestNew(TestCase):
|
class WorkoutCompareTestNew(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@@ -1642,3 +1168,126 @@ class MarkerPerformanceTest(TestCase):
|
|||||||
|
|
||||||
response = self.c.post(url,form_data)
|
response = self.c.post(url,form_data)
|
||||||
self.assertEqual(response.status_code,200)
|
self.assertEqual(response.status_code,200)
|
||||||
|
|
||||||
|
class AlertTest(TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.u = UserFactory()
|
||||||
|
|
||||||
|
self.r = Rower.objects.create(user=self.u,
|
||||||
|
birthdate=faker.profile()['birthdate'],
|
||||||
|
gdproptin=True,surveydone=True,
|
||||||
|
gdproptindate=timezone.now(),
|
||||||
|
rowerplan='coach')
|
||||||
|
|
||||||
|
self.c = Client()
|
||||||
|
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
|
||||||
|
self.factory = RequestFactory()
|
||||||
|
self.password = faker.word()
|
||||||
|
self.u.set_password(self.password)
|
||||||
|
self.u.save()
|
||||||
|
|
||||||
|
# need a 2k, 5k, 1h row
|
||||||
|
self.werg2k = WorkoutFactory(
|
||||||
|
user=self.r,
|
||||||
|
duration=datetime.time(hour=0,minute=7,second=0),
|
||||||
|
distance=2000,
|
||||||
|
workouttype='rower',
|
||||||
|
rankingpiece=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
# need a 2k, 5k, 1h row
|
||||||
|
self.werg5k = WorkoutFactory(
|
||||||
|
user=self.r,
|
||||||
|
duration=datetime.time(hour=0,minute=18,second=0),
|
||||||
|
distance=5000,
|
||||||
|
workouttype='rower',
|
||||||
|
rankingpiece=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
# need a 2k, 5k, 1h row
|
||||||
|
self.werg1h = WorkoutFactory(
|
||||||
|
user=self.r,
|
||||||
|
duration=datetime.time(hour=1,minute=0,second=0),
|
||||||
|
distance=15000,
|
||||||
|
workouttype='rower',
|
||||||
|
rankingpiece=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
for workout in self.user_workouts:
|
||||||
|
try:
|
||||||
|
os.remove(workout.csvfilename)
|
||||||
|
except (IOError, FileNotFoundError, OSError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@patch('rowers.dataprep.create_engine')
|
||||||
|
@patch('rowers.alerts.getsmallrowdata_db')
|
||||||
|
def test_alerts(self, mocked_sqlalchemy,
|
||||||
|
mocked_getsmallrowdata_db):
|
||||||
|
login = self.c.login(username=self.u.username,password=self.password)
|
||||||
|
self.assertTrue(login)
|
||||||
|
|
||||||
|
startdate = (self.user_workouts[0].startdatetime-datetime.timedelta(days=3)).date()
|
||||||
|
enddate = (self.user_workouts[0].startdatetime+datetime.timedelta(days=3)).date()
|
||||||
|
|
||||||
|
url = reverse('alerts_view')
|
||||||
|
response = self.c.get(url)
|
||||||
|
self.assertEqual(response.status_code,200)
|
||||||
|
|
||||||
|
# create alert
|
||||||
|
url = reverse('alert_create_view')
|
||||||
|
response = self.c.get(url)
|
||||||
|
self.assertEqual(response.status_code,200)
|
||||||
|
|
||||||
|
data = {
|
||||||
|
'name': 'Ss',
|
||||||
|
'period':7,
|
||||||
|
'emailalert': True,
|
||||||
|
'boattype':'1x',
|
||||||
|
'workouttype':'water',
|
||||||
|
'reststrokes':False,
|
||||||
|
'metric':'spm',
|
||||||
|
'condition':'<',
|
||||||
|
'value1':20,
|
||||||
|
'value2':22,
|
||||||
|
# management_form data
|
||||||
|
'form-INITIAL_FORMS': '0',
|
||||||
|
'form-TOTAL_FORMS': '1',
|
||||||
|
'form-MAX_NUM_FORMS': '',
|
||||||
|
|
||||||
|
# First condition data
|
||||||
|
'form-0-metric': 'hr',
|
||||||
|
'form-0-condition': '>',
|
||||||
|
'form-0-value1': 120,
|
||||||
|
'form-0-value2': 130
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
form = AlertEditForm(data)
|
||||||
|
self.assertTrue(form.is_valid())
|
||||||
|
|
||||||
|
response = self.c.post(url,data,follow=True)
|
||||||
|
expected_url = reverse('alert_edit_view',kwargs={'id':1})
|
||||||
|
self.assertRedirects(response,expected_url=expected_url,status_code=302,target_status_code=200)
|
||||||
|
|
||||||
|
url = expected_url
|
||||||
|
response = self.c.post(url,data)
|
||||||
|
self.assertEqual(response.status_code,200)
|
||||||
|
|
||||||
|
data = {}
|
||||||
|
|
||||||
|
url = reverse('alert_report_view',kwargs={'id':1,'userid':self.u.id})
|
||||||
|
response = self.c.get(url)
|
||||||
|
self.assertEqual(response.status_code,200)
|
||||||
|
|
||||||
|
# delete
|
||||||
|
url = '/rowers/alerts/1/delete/'
|
||||||
|
response = self.c.get(url)
|
||||||
|
self.assertEqual(response.status_code,200)
|
||||||
|
|
||||||
|
|
||||||
|
response = self.c.post(url,data,follow=True)
|
||||||
|
expected_url = reverse('alerts_view')
|
||||||
|
self.assertRedirects(response,expected_url=expected_url,status_code=302,target_status_code=200)
|
||||||
|
|
||||||
|
#
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import pandas as pd
|
|||||||
nu = datetime.datetime.now()
|
nu = datetime.datetime.now()
|
||||||
from rowers import tasks
|
from rowers import tasks
|
||||||
|
|
||||||
|
import rowers.courses as courses
|
||||||
|
|
||||||
|
|
||||||
class fakejob:
|
class fakejob:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -53,6 +55,15 @@ class AsyncTaskTests(TestCase):
|
|||||||
workouttype = 'water',
|
workouttype = 'water',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
cs = courses.kmltocourse('rowers/tests/testdata/thyro.kml')
|
||||||
|
course = cs[0]
|
||||||
|
cname = course['name']
|
||||||
|
cnotes = course['description']
|
||||||
|
polygons = course['polygons']
|
||||||
|
self.ThyroBaantje = courses.createcourse(self.r,cname,polygons,notes=cnotes)
|
||||||
|
self.ThyroBaantje.save()
|
||||||
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
for workout in self.user_workouts:
|
for workout in self.user_workouts:
|
||||||
try:
|
try:
|
||||||
@@ -68,6 +79,92 @@ class AsyncTaskTests(TestCase):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def test_polygons(self):
|
||||||
|
polygons = GeoPolygon.objects.all()
|
||||||
|
polygon = polygons[0]
|
||||||
|
obj = (polygon.id,polygon.name)
|
||||||
|
path = tasks.polygon_to_path(obj)
|
||||||
|
self.assertEqual(len(path),4)
|
||||||
|
|
||||||
|
def test_summaryfromsplitdata(self):
|
||||||
|
splitdata = [
|
||||||
|
{
|
||||||
|
"type": "distance",
|
||||||
|
"time": 415,
|
||||||
|
"rest_time": 600,
|
||||||
|
"stroke_rate": 35,
|
||||||
|
"distance": 220,
|
||||||
|
"heart_rate": {
|
||||||
|
"ending": 160,
|
||||||
|
"rest": 60
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "distance",
|
||||||
|
"time": 347,
|
||||||
|
"rest_time": 600,
|
||||||
|
"stroke_rate": 45,
|
||||||
|
"distance": 220,
|
||||||
|
"heart_rate": {
|
||||||
|
"ending": 170,
|
||||||
|
"rest": 70
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
data = {
|
||||||
|
"date": "2015-08-30 14:24:00",
|
||||||
|
"timezone": "Europe/London",
|
||||||
|
"distance": 440,
|
||||||
|
"time": 762,
|
||||||
|
"type": "rower",
|
||||||
|
"weight_class": "H",
|
||||||
|
"heart_rate": {
|
||||||
|
"average": 140
|
||||||
|
},
|
||||||
|
"workout_type": "FixedDistanceInterval",
|
||||||
|
"rest_distance": 43,
|
||||||
|
"rest_time": 1200,
|
||||||
|
"workout": {
|
||||||
|
"targets": {
|
||||||
|
"stroke_rate": 30,
|
||||||
|
"heart_rate_zone": 4,
|
||||||
|
"pace": 1050
|
||||||
|
},
|
||||||
|
"intervals": [
|
||||||
|
{
|
||||||
|
"type": "distance",
|
||||||
|
"time": 415,
|
||||||
|
"rest_time": 600,
|
||||||
|
"stroke_rate": 35,
|
||||||
|
"distance": 220,
|
||||||
|
"heart_rate": {
|
||||||
|
"ending": 160,
|
||||||
|
"rest": 60
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "distance",
|
||||||
|
"time": 347,
|
||||||
|
"rest_time": 600,
|
||||||
|
"stroke_rate": 45,
|
||||||
|
"distance": 220,
|
||||||
|
"heart_rate": {
|
||||||
|
"ending": 170,
|
||||||
|
"rest": 70
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
res = tasks.summaryfromsplitdata(splitdata,data,'test.csv')
|
||||||
|
|
||||||
|
self.assertEqual(len(res[0]),478)
|
||||||
|
|
||||||
|
@patch('rowers.tasks.stravalib.Client', side_effect=MockStravalibClient)
|
||||||
|
def test_strava_sync(self,MockStravalibClient):
|
||||||
|
res = tasks.handle_strava_sync('aap',self.wwater.id,self.wwater.csvfilename,'aap','activitytype','aa')
|
||||||
|
self.assertEqual(res,1)
|
||||||
|
|
||||||
def test_safetimedelta(self):
|
def test_safetimedelta(self):
|
||||||
x = 5
|
x = 5
|
||||||
@@ -420,13 +517,6 @@ class AsyncTaskTests(TestCase):
|
|||||||
res = tasks.handle_updateergcp(1,[f1])
|
res = tasks.handle_updateergcp(1,[f1])
|
||||||
self.assertEqual(res,1)
|
self.assertEqual(res,1)
|
||||||
|
|
||||||
@patch('rowers.dataprepnodjango.getsmallrowdata_db')
|
|
||||||
def test_cp_from_workoutids(self,mocked_getsmallrowdata_db):
|
|
||||||
ids = [1]
|
|
||||||
powerfourmin,power2k,powerhour = tasks.cp_from_workoutids(ids)
|
|
||||||
self.assertFalse(powerfourmin==0)
|
|
||||||
self.assertFalse(power2k==0)
|
|
||||||
self.assertFalse(powerhour==0)
|
|
||||||
|
|
||||||
@patch('rowers.dataprepnodjango.getsmallrowdata_db')
|
@patch('rowers.dataprepnodjango.getsmallrowdata_db')
|
||||||
def test_handle_updatecp(self,mocked_getsmallrowdata_db):
|
def test_handle_updatecp(self,mocked_getsmallrowdata_db):
|
||||||
|
|||||||
@@ -432,24 +432,20 @@ class NKObjects(DjangoTestCase):
|
|||||||
|
|
||||||
self.assertEqual(response.status_code,200)
|
self.assertEqual(response.status_code,200)
|
||||||
|
|
||||||
@patch('rowers.nkimportutils.requests.session', side_effect=mocked_session)
|
@patch('rowers.tasks.requests.get', side_effect=mocked_requests)
|
||||||
@patch('rowers.tasks.requests.get', side_effects=mocked_requests)
|
def test_handle_nk_get_workouts(self, mock_get):
|
||||||
def test_handle_nk_get_workouts(self, mocked_session, mock_get):
|
|
||||||
with open('rowers/tests/testdata/nk_list.json','r') as f:
|
with open('rowers/tests/testdata/nk_list.json','r') as f:
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
|
|
||||||
with open('rowers/tests/testdata/nk_strokes.json','r') as f:
|
|
||||||
strokeData = json.load(f)
|
|
||||||
|
|
||||||
alldata = {}
|
alldata = {}
|
||||||
for item in data:
|
for item in data:
|
||||||
alldata[item['id']] = item
|
alldata[item['id']] = item
|
||||||
|
|
||||||
result = rowers.nkstuff.rower_nk_token_refresh(self.u)
|
|
||||||
|
|
||||||
res = tasks.handle_nk_async_workout(
|
res = tasks.handle_nk_async_workout(
|
||||||
alldata,self.r.user.id,self.r.nktoken,469,0,'UTC'
|
alldata,self.r.user.id,self.r.nktoken,469,0,'UTC'
|
||||||
)
|
)
|
||||||
|
self.assertTrue(res>0)
|
||||||
|
|
||||||
|
|
||||||
@patch('rowers.nkstuff.requests.get', side_effect=mocked_requests)
|
@patch('rowers.nkstuff.requests.get', side_effect=mocked_requests)
|
||||||
@@ -570,21 +566,6 @@ class StravaObjects(DjangoTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# @patch('rowers.stravastuff.requests.post', side_effect=mocked_requests)
|
|
||||||
# @patch('rowers.views.stravastuff.handle_stravaexport')
|
|
||||||
#@patch('rowers.dataprep.getsmallrowdata_db')
|
|
||||||
#def test_strava_upload(self, mock_post,MockStravalibClient,
|
|
||||||
# mocked_getsmallrowdata_db):
|
|
||||||
# def test_strava_upload(self,mock_post, mocked_stravaexport):
|
|
||||||
# response = self.c.get('/rowers/workout/1/stravauploadw/')
|
|
||||||
|
|
||||||
# self.assertRedirects(response,
|
|
||||||
# expected_url = '/rowers/workout/1/edit/',
|
|
||||||
# status_code=302,target_status_code=200)
|
|
||||||
|
|
||||||
# self.assertEqual(response.url, '/rowers/workout/1/edit/')
|
|
||||||
# self.assertEqual(response.status_code, 302)
|
|
||||||
|
|
||||||
@patch('rowers.stravastuff.requests.get', side_effect=mocked_requests)
|
@patch('rowers.stravastuff.requests.get', side_effect=mocked_requests)
|
||||||
@patch('rowers.stravastuff.requests.post', side_effect=mocked_requests)
|
@patch('rowers.stravastuff.requests.post', side_effect=mocked_requests)
|
||||||
def test_strava_list(self, mock_get, mockpost):
|
def test_strava_list(self, mock_get, mockpost):
|
||||||
|
|||||||
@@ -857,7 +857,7 @@ class PermissionsViewTests(TestCase):
|
|||||||
self.assertTrue(login)
|
self.assertTrue(login)
|
||||||
|
|
||||||
|
|
||||||
url = reverse('cumstats',
|
url = reverse('analysis_new',
|
||||||
kwargs={
|
kwargs={
|
||||||
'userid':self.ubasic.id,
|
'userid':self.ubasic.id,
|
||||||
}
|
}
|
||||||
@@ -877,7 +877,7 @@ class PermissionsViewTests(TestCase):
|
|||||||
self.assertTrue(login)
|
self.assertTrue(login)
|
||||||
|
|
||||||
|
|
||||||
url = reverse('cumstats',
|
url = reverse('analysis_new',
|
||||||
kwargs={
|
kwargs={
|
||||||
'userid':self.ubasic.id,
|
'userid':self.ubasic.id,
|
||||||
}
|
}
|
||||||
@@ -1153,7 +1153,7 @@ class PermissionsViewTests(TestCase):
|
|||||||
self.assertTrue(login)
|
self.assertTrue(login)
|
||||||
|
|
||||||
|
|
||||||
url = reverse('cumstats',
|
url = reverse('analysis_new',
|
||||||
kwargs={
|
kwargs={
|
||||||
'userid':self.ubasic.id,
|
'userid':self.ubasic.id,
|
||||||
}
|
}
|
||||||
@@ -1276,7 +1276,7 @@ class PermissionsViewTests(TestCase):
|
|||||||
self.assertTrue(login)
|
self.assertTrue(login)
|
||||||
|
|
||||||
|
|
||||||
url = reverse('cumstats',
|
url = reverse('analysis_new',
|
||||||
kwargs={
|
kwargs={
|
||||||
'userid':self.ubasic.id,
|
'userid':self.ubasic.id,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -729,6 +729,20 @@ class ChallengesTest(TestCase):
|
|||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
|
||||||
|
@patch('rowers.tasks.create_engine', side_effect=mocked_sqlalchemy_courses)
|
||||||
|
def notest_virtualevent_check_view(self,mocked_sqlalchemy_courses):
|
||||||
|
|
||||||
|
res = tasks.handle_check_race_course(
|
||||||
|
self.wthyro.csvfilename,
|
||||||
|
self.wthyro.id,
|
||||||
|
self.ThyroBaantje.id,
|
||||||
|
self.result.id,
|
||||||
|
self.wthyro.user.user.email,
|
||||||
|
self.wthyro.user.user.first_name,
|
||||||
|
mode='coursetest',
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(res,1)
|
||||||
|
|
||||||
|
|
||||||
# add boat
|
# add boat
|
||||||
|
|||||||
@@ -68,10 +68,6 @@ class URLTests(TestCase):
|
|||||||
'/rowers/404/',
|
'/rowers/404/',
|
||||||
'/rowers/500/',
|
'/rowers/500/',
|
||||||
'/rowers/502/',
|
'/rowers/502/',
|
||||||
# '/rowers/1/list-workouts/',
|
|
||||||
# '/rowers/1/list-workouts/2016-01-01/2016-12-31/',
|
|
||||||
# '/rowers/1/ote-bests/',
|
|
||||||
# '/rowers/1/ote-bests2/2016-01-01/2016-12-31/',
|
|
||||||
'/rowers/about/',
|
'/rowers/about/',
|
||||||
'/rowers/workout/addmanual/',
|
'/rowers/workout/addmanual/',
|
||||||
'/rowers/agegroupcp/30/',
|
'/rowers/agegroupcp/30/',
|
||||||
@@ -86,29 +82,10 @@ class URLTests(TestCase):
|
|||||||
'/rowers/courses/upload/',
|
'/rowers/courses/upload/',
|
||||||
'/rowers/createplan/',
|
'/rowers/createplan/',
|
||||||
'/rowers/createplan/user/1/',
|
'/rowers/createplan/user/1/',
|
||||||
'/rowers/cumstats/',
|
|
||||||
# '/rowers/cumstats/2016-01-01/2016-12-31/',
|
|
||||||
'/rowers/cumstats/user/1/',
|
|
||||||
# '/rowers/cumstats/user/1/2016-01-01/2016-12-31/',
|
|
||||||
'/rowers/developers/',
|
'/rowers/developers/',
|
||||||
'/rowers/email/',
|
'/rowers/email/',
|
||||||
'/rowers/email/thankyou/',
|
'/rowers/email/thankyou/',
|
||||||
# '/rowers/fitness-progress/',
|
|
||||||
# '/rowers/fitness-progress/user/1/',
|
|
||||||
# '/rowers/fitness-progress/user/1/rower/',
|
|
||||||
'/rowers/flexall/',
|
|
||||||
'/rowers/flexall/spm/hr/None/',
|
|
||||||
# '/rowers/flexall/spm/hr/None/2016-01-01/2016-12-31/',
|
|
||||||
# '/rowers/flexall/spm/hr/None/2016-01-01/2016-12-31/user/1/',
|
|
||||||
'/rowers/flexall/user/1/',
|
|
||||||
'/rowers/flexalldata/',
|
|
||||||
'/rowers/help/',
|
'/rowers/help/',
|
||||||
'/rowers/histo/',
|
|
||||||
'/rowers/histo/user/1/',
|
|
||||||
# '/rowers/histo/user/1/2016-01-01/2016-12-31/',
|
|
||||||
'/rowers/histodata/',
|
|
||||||
# '/rowers/job-kill/1/',
|
|
||||||
# '/rowers/jobs-status/',
|
|
||||||
'/rowers/laboratory/',
|
'/rowers/laboratory/',
|
||||||
'/rowers/laboratory/user/1/',
|
'/rowers/laboratory/user/1/',
|
||||||
'/rowers/legal/',
|
'/rowers/legal/',
|
||||||
@@ -116,8 +93,6 @@ class URLTests(TestCase):
|
|||||||
'/rowers/list-graphs/',
|
'/rowers/list-graphs/',
|
||||||
'/rowers/list-jobs/',
|
'/rowers/list-jobs/',
|
||||||
'/rowers/list-workouts/',
|
'/rowers/list-workouts/',
|
||||||
# '/rowers/list-workouts/2016-01-01/2016-12-31/',
|
|
||||||
# '/rowers/list-workouts/2016-01-01/2016-12-31/user/1/',
|
|
||||||
'/rowers/list-workouts/ranking/',
|
'/rowers/list-workouts/ranking/',
|
||||||
'/rowers/list-workouts/user/1/',
|
'/rowers/list-workouts/user/1/',
|
||||||
'/rowers/me/calcdps/',
|
'/rowers/me/calcdps/',
|
||||||
@@ -135,65 +110,23 @@ class URLTests(TestCase):
|
|||||||
'/rowers/me/workflowconfig2/',
|
'/rowers/me/workflowconfig2/',
|
||||||
'/rowers/me/workflowconfig2/user/1/',
|
'/rowers/me/workflowconfig2/user/1/',
|
||||||
'/rowers/me/workflowdefault/',
|
'/rowers/me/workflowdefault/',
|
||||||
# '/rowers/multi-compare/',
|
|
||||||
# '/rowers/ote-bests/',
|
|
||||||
# '/rowers/ote-bests/2016-01-01/2016-12-31/',
|
|
||||||
# '/rowers/ote-bests/user/1/',
|
|
||||||
# '/rowers/ote-bests/user/1/2016-01-01/2016-12-31/',
|
|
||||||
'/rowers/ote-bests2/',
|
'/rowers/ote-bests2/',
|
||||||
# '/rowers/ote-bests2/2016-01-01/2016-12-31/',
|
|
||||||
'/rowers/ote-bests2/user/1/',
|
'/rowers/ote-bests2/user/1/',
|
||||||
# '/rowers/ote-ranking/',
|
|
||||||
# '/rowers/ote-ranking/2016-01-01/2016-12-31/',
|
|
||||||
# '/rowers/ote-ranking/user/1/',
|
|
||||||
# '/rowers/ote-ranking/user/1/2016-01-01/2016-12-31/',
|
|
||||||
# '/rowers/otw-bests/',
|
|
||||||
# '/rowers/otw-bests/2016-01-01/2016-12-31/',
|
|
||||||
# '/rowers/otw-bests/user/1/2016-01-01/2016-12-31/',
|
|
||||||
'/rowers/partners/',
|
'/rowers/partners/',
|
||||||
'/rowers/physics/',
|
'/rowers/physics/',
|
||||||
'/rowers/planrequired/',
|
'/rowers/planrequired/',
|
||||||
# '/rowers/promembership/',
|
|
||||||
'/rowers/register/',
|
'/rowers/register/',
|
||||||
'/rowers/register/thankyou/',
|
'/rowers/register/thankyou/',
|
||||||
'/rowers/sessions/',
|
'/rowers/sessions/',
|
||||||
# '/rowers/sessions/2016-01-01/2016-12-31/',
|
|
||||||
# '/rowers/sessions/2016-01-01/2016-12-31/user/1/',
|
|
||||||
'/rowers/sessions/coach/',
|
'/rowers/sessions/coach/',
|
||||||
# '/rowers/sessions/coach/user/1/',
|
|
||||||
'/rowers/sessions/create/',
|
'/rowers/sessions/create/',
|
||||||
# '/rowers/sessions/create/user/1/',
|
|
||||||
'/rowers/sessions/manage/',
|
'/rowers/sessions/manage/',
|
||||||
# '/rowers/sessions/manage/user/1/',
|
|
||||||
'/rowers/sessions/multiclone/',
|
'/rowers/sessions/multiclone/',
|
||||||
# '/rowers/sessions/multiclone/user/1/',
|
|
||||||
'/rowers/sessions/multicreate/',
|
'/rowers/sessions/multicreate/',
|
||||||
# '/rowers/sessions/multicreate/user/1/',
|
|
||||||
'/rowers/sessions/print/',
|
'/rowers/sessions/print/',
|
||||||
# '/rowers/sessions/print/user/1/',
|
|
||||||
'/rowers/sessions/teamcreate/',
|
'/rowers/sessions/teamcreate/',
|
||||||
# '/rowers/sessions/user/1/',
|
|
||||||
'/rowers/team-compare-select/',
|
'/rowers/team-compare-select/',
|
||||||
'/rowers/team-compare-select/workout/'+encoded1+'/',
|
'/rowers/team-compare-select/workout/'+encoded1+'/',
|
||||||
# '/rowers/team-compare-select/2016-01-01/2016-12-31/',
|
|
||||||
# '/rowers/test-job/2/',
|
|
||||||
# '/rowers/test-job2/2/',
|
|
||||||
# '/rowers/test_callback/',
|
|
||||||
# '/rowers/updatefitness/',
|
|
||||||
# '/rowers/updatefitness/rower/',
|
|
||||||
# '/rowers/updatefitness/rower/50/',
|
|
||||||
# '/rowers/user-boxplot/',
|
|
||||||
# '/rowers/user-boxplot-data/',
|
|
||||||
# '/rowers/user-boxplot-select/',
|
|
||||||
# '/rowers/user-boxplot-select/user/1/',
|
|
||||||
# '/rowers/user-boxplot/user/1/',
|
|
||||||
# '/rowers/user-multiflex-data/',
|
|
||||||
# '/rowers/user-multiflex-select/',
|
|
||||||
# '/rowers/user-multiflex-select/2016-01-01/2016-12-31/',
|
|
||||||
# '/rowers/user-multiflex-select/user/1/',
|
|
||||||
# '/rowers/user-multiflex-select/user/1/2016-01-01/2016-12-31/',
|
|
||||||
# '/rowers/user-multiflex/',
|
|
||||||
# '/rowers/user-multiflex/user/1/',
|
|
||||||
'/rowers/workout/'+encoded1+'/',
|
'/rowers/workout/'+encoded1+'/',
|
||||||
'/rowers/workout/'+encoded1+'/adddistanceplot/',
|
'/rowers/workout/'+encoded1+'/adddistanceplot/',
|
||||||
'/rowers/workout/'+encoded1+'/adddistanceplot2/',
|
'/rowers/workout/'+encoded1+'/adddistanceplot2/',
|
||||||
@@ -224,27 +157,21 @@ class URLTests(TestCase):
|
|||||||
'/rowers/workout/'+encoded1+'/split/',
|
'/rowers/workout/'+encoded1+'/split/',
|
||||||
'/rowers/workout/'+encoded1+'/stats/',
|
'/rowers/workout/'+encoded1+'/stats/',
|
||||||
'/rowers/workout/'+encoded1+'/stream/',
|
'/rowers/workout/'+encoded1+'/stream/',
|
||||||
# '/rowers/workout/'+encoded1+'/task/',
|
|
||||||
# '/rowers/workout/'+encoded1+'/teststrokedata/',
|
|
||||||
'/rowers/workout/'+encoded1+'/toggle-ranking/',
|
'/rowers/workout/'+encoded1+'/toggle-ranking/',
|
||||||
'/rowers/workout/'+encoded1+'/undosmoothenpace/',
|
'/rowers/workout/'+encoded1+'/undosmoothenpace/',
|
||||||
'/rowers/workout/'+encoded1+'/unsubscribe/',
|
'/rowers/workout/'+encoded1+'/unsubscribe/',
|
||||||
# '/rowers/workout/'+encoded1+'/updatecp/',
|
|
||||||
'/rowers/workout/'+encoded1+'/view/',
|
'/rowers/workout/'+encoded1+'/view/',
|
||||||
'/rowers/workout/'+encoded1+'/wind/',
|
'/rowers/workout/'+encoded1+'/wind/',
|
||||||
'/rowers/workout/'+encoded1+'/workflow/',
|
'/rowers/workout/'+encoded1+'/workflow/',
|
||||||
'/rowers/workout/fusion/'+encoded1+'/',
|
'/rowers/workout/fusion/'+encoded1+'/',
|
||||||
# '/rowers/workout/fusion/'+encoded1+'/2016-01-01/2016-12-31/',
|
|
||||||
'/rowers/workout/upload/',
|
'/rowers/workout/upload/',
|
||||||
'/rowers/workout/upload/team/',
|
'/rowers/workout/upload/team/',
|
||||||
'/rowers/workouts-join/',
|
'/rowers/workouts-join/',
|
||||||
'/rowers/workouts-join-select/',
|
'/rowers/workouts-join-select/',
|
||||||
# '/rowers/workouts-join-select/2016-01-01/2016-12-31/',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# urlstotest = ['/rowers/createplan/user/1/']
|
|
||||||
|
|
||||||
lijst = []
|
lijst = []
|
||||||
for url in urlstotest:
|
for url in urlstotest:
|
||||||
|
|||||||
@@ -26,9 +26,7 @@
|
|||||||
25,27,team_comparison_select,compare with a team member workout,TRUE,302,pro,200,302,pro,200,302,coach,200,302,FALSE,TRUE,TRUE,TRUE,TRUE,
|
25,27,team_comparison_select,compare with a team member workout,TRUE,302,pro,200,302,pro,200,302,coach,200,302,FALSE,TRUE,TRUE,TRUE,TRUE,
|
||||||
26,28,workouts_join_view,join workouts,TRUE,302,pro,302,302,pro,403,403,coach,302,403,FALSE,TRUE,FALSE,TRUE,TRUE,
|
26,28,workouts_join_view,join workouts,TRUE,302,pro,302,302,pro,403,403,coach,302,403,FALSE,TRUE,FALSE,TRUE,TRUE,
|
||||||
27,29,workouts_join_select,select workouts to join,TRUE,404,pro,200,302,pro,403,403,coach,200,403,FALSE,TRUE,FALSE,TRUE,TRUE,
|
27,29,workouts_join_select,select workouts to join,TRUE,404,pro,200,302,pro,403,403,coach,200,403,FALSE,TRUE,FALSE,TRUE,TRUE,
|
||||||
28,30,user_boxplot_select,select boxplots,TRUE,302,pro,200,302,pro,403,403,coach,200,302,FALSE,TRUE,FALSE,TRUE,TRUE,
|
|
||||||
29,31,analysis_new,analysis front page,TRUE,302,pro,200,302,FALSE,200,302,coach,200,302,FALSE,TRUE,FALSE,TRUE,TRUE,
|
29,31,analysis_new,analysis front page,TRUE,302,pro,200,302,FALSE,200,302,coach,200,302,FALSE,TRUE,FALSE,TRUE,TRUE,
|
||||||
30,32,user_multiflex_select,select multiflex data,TRUE,302,pro,200,302,FALSE,200,302,coach,200,302,FALSE,TRUE,FALSE,TRUE,TRUE,
|
|
||||||
31,33,session_jobs_view,view jobs,TRUE,302,basic,200,302,FALSE,200,302,coach,200,302,FALSE,FALSE,FALSE,TRUE,TRUE,
|
31,33,session_jobs_view,view jobs,TRUE,302,basic,200,302,FALSE,200,302,coach,200,302,FALSE,FALSE,FALSE,TRUE,TRUE,
|
||||||
32,34,session_jobs_status,view jobs,TRUE,302,basic,200,302,FALSE,200,302,coach,200,302,FALSE,FALSE,FALSE,TRUE,TRUE,
|
32,34,session_jobs_status,view jobs,TRUE,302,basic,200,302,FALSE,200,302,coach,200,302,FALSE,FALSE,FALSE,TRUE,TRUE,
|
||||||
33,35,kill_async_job,kill job,TRUE,302,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE,
|
33,35,kill_async_job,kill job,TRUE,302,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE,
|
||||||
@@ -38,9 +36,6 @@
|
|||||||
41,43,cum_flex,flex all chart,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE,
|
41,43,cum_flex,flex all chart,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE,
|
||||||
42,44,analysis_view_data,redirects to analysis direct,TRUE,302,pro,200,302,pro,200,302,coach,200,302,FALSE,FALSE,FALSE,TRUE,TRUE,
|
42,44,analysis_view_data,redirects to analysis direct,TRUE,302,pro,200,302,pro,200,302,coach,200,302,FALSE,FALSE,FALSE,TRUE,TRUE,
|
||||||
43,47,cum_flex_data,flex all chart data (json),TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE,
|
43,47,cum_flex_data,flex all chart data (json),TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE,
|
||||||
44,48,histo,histogram view,TRUE,302,pro,200,302,pro,403,302,coach,200,302,FALSE,TRUE,FALSE,TRUE,TRUE,
|
|
||||||
45,49,histo_data,histogram data,TRUE,302,pro,200,302,pro,200,302,coach,200,302,FALSE,FALSE,FALSE,TRUE,TRUE,
|
|
||||||
46,51,cumstats,cumulative statistics,TRUE,302,pro,200,302,pro,403,302,coach,200,302,FALSE,TRUE,FALSE,TRUE,TRUE,
|
|
||||||
47,53,graph_show_view,show a chart,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE,
|
47,53,graph_show_view,show a chart,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE,
|
||||||
48,54,GraphDelete,delete a chart,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE,
|
48,54,GraphDelete,delete a chart,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE,
|
||||||
49,55,get_thumbnails,get thumbnails,TRUE,403,basic,200,302,basic,403,403,coach,200,302,FALSE,FALSE,TRUE,TRUE,TRUE,
|
49,55,get_thumbnails,get thumbnails,TRUE,403,basic,200,302,basic,403,403,coach,200,302,FALSE,FALSE,TRUE,TRUE,TRUE,
|
||||||
@@ -114,10 +109,6 @@
|
|||||||
119,148,alert_edit_view,edit alert,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE,
|
119,148,alert_edit_view,edit alert,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE,
|
||||||
120,150,alert_create_view,create alert,TRUE,302,pro,200,403,pro,403,403,coach,200,403,FALSE,TRUE,FALSE,TRUE,TRUE,
|
120,150,alert_create_view,create alert,TRUE,302,pro,200,403,pro,403,403,coach,200,403,FALSE,TRUE,FALSE,TRUE,TRUE,
|
||||||
121,152,alert_report_view,view alerts report,TRUE,302,basic,200,403,basic,403,403,coach,200,403,FALSE,FALSE,FALSE,FALSE,FALSE,
|
121,152,alert_report_view,view alerts report,TRUE,302,basic,200,403,basic,403,403,coach,200,403,FALSE,FALSE,FALSE,FALSE,FALSE,
|
||||||
122,155,boxplot_view,View boxplot,TRUE,302,pro,302,403,pro,403,403,coach,302,403,FALSE,TRUE,FALSE,TRUE,TRUE,
|
|
||||||
123,157,boxplot_view_data,data for boxplot,TRUE,302,pro,200,403,pro,200,403,coach,200,403,FALSE,FALSE,FALSE,FALSE,FALSE,
|
|
||||||
124,158,multiflex_view,view multiflex,TRUE,302,pro,302,403,pro,403,403,coach,302,403,FALSE,TRUE,FALSE,TRUE,TRUE,
|
|
||||||
125,160,multiflex_data,data for multiflex,TRUE,302,pro,200,403,pro,200,403,coach,200,403,FALSE,FALSE,FALSE,FALSE,FALSE,
|
|
||||||
126,161,deactivate_user,deactivate a user,TRUE,302,basic,200,302,FALSE,403,403,FALSE,403,403,FALSE,FALSE,FALSE,TRUE,TRUE,
|
126,161,deactivate_user,deactivate a user,TRUE,302,basic,200,302,FALSE,403,403,FALSE,403,403,FALSE,FALSE,FALSE,TRUE,TRUE,
|
||||||
127,162,remove_user,remove a user,TRUE,302,basic,200,302,FALSE,403,403,FALSE,403,403,FALSE,FALSE,FALSE,TRUE,TRUE,
|
127,162,remove_user,remove a user,TRUE,302,basic,200,302,FALSE,403,403,FALSE,403,403,FALSE,FALSE,FALSE,TRUE,TRUE,
|
||||||
128,163,user_gdpr_confirm,GDPR confirmation,TRUE,302,basic,302,302,FALSE,403,403,FALSE,403,403,FALSE,FALSE,FALSE,TRUE,TRUE,
|
128,163,user_gdpr_confirm,GDPR confirmation,TRUE,302,basic,302,302,FALSE,403,403,FALSE,403,403,FALSE,FALSE,FALSE,TRUE,TRUE,
|
||||||
|
|||||||
|
@@ -325,8 +325,6 @@ urlpatterns = [
|
|||||||
re_path(r'^workouts-join/user/(?P<userid>\d+)$',views.workouts_join_view,name='workouts_join_view'),
|
re_path(r'^workouts-join/user/(?P<userid>\d+)$',views.workouts_join_view,name='workouts_join_view'),
|
||||||
re_path(r'^workouts-join-select/$',views.workouts_join_select,name='workouts_join_select'),
|
re_path(r'^workouts-join-select/$',views.workouts_join_select,name='workouts_join_select'),
|
||||||
re_path(r'^workouts-join-select/user/(?P<userid>\d+)/$',views.workouts_join_select,name='workouts_join_select'),
|
re_path(r'^workouts-join-select/user/(?P<userid>\d+)/$',views.workouts_join_select,name='workouts_join_select'),
|
||||||
re_path(r'^user-boxplot-select/user/(?P<userid>\d+)/$',views.user_boxplot_select,name='user_boxplot_select'),
|
|
||||||
re_path(r'^user-boxplot-select/$',views.user_boxplot_select,name='user_boxplot_select'),
|
|
||||||
re_path(r'^user-analysis-select/(?P<function>\w.*)/workout/(?P<id>\b[0-9A-Fa-f]+\b)/$',views.analysis_new,name='analysis_new'),
|
re_path(r'^user-analysis-select/(?P<function>\w.*)/workout/(?P<id>\b[0-9A-Fa-f]+\b)/$',views.analysis_new,name='analysis_new'),
|
||||||
re_path(r'^user-analysis-select/(?P<function>\w.*)/user/(?P<userid>\d+)/$',views.analysis_new,name='analysis_new'),
|
re_path(r'^user-analysis-select/(?P<function>\w.*)/user/(?P<userid>\d+)/$',views.analysis_new,name='analysis_new'),
|
||||||
re_path(r'^user-analysis-select/(?P<function>\w.*)/team/(?P<teamid>\d+)/$',views.analysis_new,name='analysis_new'),
|
re_path(r'^user-analysis-select/(?P<function>\w.*)/team/(?P<teamid>\d+)/$',views.analysis_new,name='analysis_new'),
|
||||||
@@ -334,8 +332,6 @@ urlpatterns = [
|
|||||||
re_path(r'^user-analysis-select/team/(?P<teamid>\d+)/$',views.analysis_new,name='analysis_new'),
|
re_path(r'^user-analysis-select/team/(?P<teamid>\d+)/$',views.analysis_new,name='analysis_new'),
|
||||||
re_path(r'^user-analysis-select/(?P<function>\w.*)/$',views.analysis_new,name='analysis_new'),
|
re_path(r'^user-analysis-select/(?P<function>\w.*)/$',views.analysis_new,name='analysis_new'),
|
||||||
re_path(r'^user-analysis-select/$',views.analysis_new,name='analysis_new'),
|
re_path(r'^user-analysis-select/$',views.analysis_new,name='analysis_new'),
|
||||||
re_path(r'^user-multiflex-select/user/(?P<userid>\d+)/$',views.user_multiflex_select,name='user_multiflex_select'),
|
|
||||||
re_path(r'^user-multiflex-select/$',views.user_multiflex_select,name='user_multiflex_select'),
|
|
||||||
re_path(r'^list-jobs/$',views.session_jobs_view,name='session_jobs_view'),
|
re_path(r'^list-jobs/$',views.session_jobs_view,name='session_jobs_view'),
|
||||||
re_path(r'^jobs-status/$',views.session_jobs_status,name='session_jobs_status'),
|
re_path(r'^jobs-status/$',views.session_jobs_status,name='session_jobs_status'),
|
||||||
re_path(r'^job-kill/(?P<id>.*)/$',views.kill_async_job),
|
re_path(r'^job-kill/(?P<id>.*)/$',views.kill_async_job),
|
||||||
@@ -356,16 +352,7 @@ urlpatterns = [
|
|||||||
re_path(r'^performancemanager/user/(?P<userid>\d+)/(?P<mode>\w+.*)/$',views.performancemanager_view,name='performancemanager_view'),
|
re_path(r'^performancemanager/user/(?P<userid>\d+)/(?P<mode>\w+.*)/$',views.performancemanager_view,name='performancemanager_view'),
|
||||||
re_path(r'^ote-bests2/user/(?P<userid>\d+)/$',views.rankings_view2,name='rankings_view2'),
|
re_path(r'^ote-bests2/user/(?P<userid>\d+)/$',views.rankings_view2,name='rankings_view2'),
|
||||||
re_path(r'^ote-bests2/$',views.rankings_view2,name='rankings_view2'),
|
re_path(r'^ote-bests2/$',views.rankings_view2,name='rankings_view2'),
|
||||||
re_path(r'^flexall/(?P<xparam>\w+.*)/(?P<yparam1>\w+.*)/(?P<yparam2>\w+.*)/$',views.cum_flex,name='cum_flex'),
|
|
||||||
re_path(r'^analysisdata/$',views.analysis_view_data,name='analysis_view_data'),
|
re_path(r'^analysisdata/$',views.analysis_view_data,name='analysis_view_data'),
|
||||||
re_path(r'^flexall/user/(?P<theuser>\d+)/$',views.cum_flex,name='cum_flex'),
|
|
||||||
re_path(r'^flexall/$',views.cum_flex,name='cum_flex'),
|
|
||||||
re_path(r'^flexalldata/$',views.cum_flex_data,name='cum_flex_data'),
|
|
||||||
re_path(r'^histo/user/(?P<userid>\d+)/$',views.histo,name='histo'),
|
|
||||||
re_path(r'^histodata/$',views.histo_data,name='histo_data'),
|
|
||||||
re_path(r'^histo/$',views.histo,name='histo'),
|
|
||||||
re_path(r'^cumstats/user/(?P<userid>\d+)/$',views.cumstats,name='cumstats'),
|
|
||||||
re_path(r'^cumstats/$',views.cumstats,name='cumstats'),
|
|
||||||
re_path(r'^graph/(?P<id>\d+)/$',views.graph_show_view,name='graph_show_view'),
|
re_path(r'^graph/(?P<id>\d+)/$',views.graph_show_view,name='graph_show_view'),
|
||||||
re_path(r'^graph/(?P<pk>\d+)/delete/$',views.GraphDelete.as_view(),name='graph_delete'),
|
re_path(r'^graph/(?P<pk>\d+)/delete/$',views.GraphDelete.as_view(),name='graph_delete'),
|
||||||
re_path(r'^workout/(?P<id>\b[0-9A-Fa-f]+\b)/get-thumbnails/$',views.get_thumbnails,
|
re_path(r'^workout/(?P<id>\b[0-9A-Fa-f]+\b)/get-thumbnails/$',views.get_thumbnails,
|
||||||
@@ -541,12 +528,6 @@ urlpatterns = [
|
|||||||
re_path(r'^alerts/(?P<id>\d+)/report/user/(?P<userid>\d+)/$',views.alert_report_view,name='alert_report_view'),
|
re_path(r'^alerts/(?P<id>\d+)/report/user/(?P<userid>\d+)/$',views.alert_report_view,name='alert_report_view'),
|
||||||
re_path(r'^alerts/(?P<id>\d+)/report/(?P<nperiod>\d+)/user/(?P<userid>\d+)/$',views.alert_report_view,name='alert_report_view'),
|
re_path(r'^alerts/(?P<id>\d+)/report/(?P<nperiod>\d+)/user/(?P<userid>\d+)/$',views.alert_report_view,name='alert_report_view'),
|
||||||
re_path(r'^alerts/(?P<id>\d+)/report/$',views.alert_report_view,name='alert_report_view'),
|
re_path(r'^alerts/(?P<id>\d+)/report/$',views.alert_report_view,name='alert_report_view'),
|
||||||
re_path(r'^user-boxplot/user/(?P<userid>\d+)/$',views.boxplot_view,name='boxplot_view'),
|
|
||||||
re_path(r'^user-boxplot/$',views.boxplot_view,name='boxplot_view'),
|
|
||||||
re_path(r'^user-boxplot-data/$',views.boxplot_view_data,name='boxplot_view_data'),
|
|
||||||
re_path(r'^user-multiflex/user/(?P<userid>\d+)/$',views.multiflex_view,name='multiflex_view'),
|
|
||||||
re_path(r'^user-multiflex/$',views.multiflex_view,name='multiflex_view'),
|
|
||||||
re_path(r'^user-multiflex-data/$',views.multiflex_data,name='multiflex_data'),
|
|
||||||
re_path(r'^me/deactivate/$',views.deactivate_user,name='deactivate_user'),
|
re_path(r'^me/deactivate/$',views.deactivate_user,name='deactivate_user'),
|
||||||
re_path(r'^me/delete/$',views.remove_user,name='remove_user'),
|
re_path(r'^me/delete/$',views.remove_user,name='remove_user'),
|
||||||
re_path(r'^survey/$',views.survey,name='survey'),
|
re_path(r'^survey/$',views.survey,name='survey'),
|
||||||
|
|||||||
+27
-2028
File diff suppressed because it is too large
Load Diff
@@ -2003,6 +2003,7 @@ def workout_getrp3importview(request,externalid):
|
|||||||
@login_required()
|
@login_required()
|
||||||
def workout_getimportview(request,externalid,source = 'c2'):
|
def workout_getimportview(request,externalid,source = 'c2'):
|
||||||
data,strokedata = importsources[source].get_workout(request.user,externalid)
|
data,strokedata = importsources[source].get_workout(request.user,externalid)
|
||||||
|
|
||||||
if not data:
|
if not data:
|
||||||
messages.error(request,"No strokedata received")
|
messages.error(request,"No strokedata received")
|
||||||
url = reverse('workouts_view')
|
url = reverse('workouts_view')
|
||||||
|
|||||||
@@ -4415,9 +4415,6 @@ def workout_edit_view(request,id=0,message="",successmessage=""):
|
|||||||
|
|
||||||
successmessage = "Changes saved"
|
successmessage = "Changes saved"
|
||||||
|
|
||||||
if rankingpiece: # pragma: no cover
|
|
||||||
dataprep.runcpupdate(row.user,type=row.workouttype)
|
|
||||||
|
|
||||||
messages.info(request,successmessage)
|
messages.info(request,successmessage)
|
||||||
else:
|
else:
|
||||||
form = WorkoutForm(instance=row)
|
form = WorkoutForm(instance=row)
|
||||||
@@ -4978,7 +4975,7 @@ def workout_upload_view(request,
|
|||||||
},
|
},
|
||||||
raceid=0):
|
raceid=0):
|
||||||
|
|
||||||
is_ajax = request_is_ajax
|
is_ajax = request_is_ajax(request)
|
||||||
if settings.TESTING:
|
if settings.TESTING:
|
||||||
is_ajax = False
|
is_ajax = False
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user