From 165b8e35e06471118f51970233542d6549e6129e Mon Sep 17 00:00:00 2001
From: Sander Roosendaal
Date: Mon, 30 Dec 2024 15:01:07 +0100
Subject: [PATCH 2/7] fix
---
rowers/idoklad.py | 13 +-
rowers/templates/paidplans.html | 192 ++------------------------
rowers/tests/test_analysis.py | 24 ++--
rowers/tests/test_payments.py | 22 +--
rowers/tests/test_rowerplans.py | 23 +--
rowers/tests/test_urls.py | 2 +-
rowers/tests/testdata/testdata.tcx.gz | Bin 3989 -> 3989 bytes
7 files changed, 45 insertions(+), 231 deletions(-)
diff --git a/rowers/idoklad.py b/rowers/idoklad.py
index 4156e12e..cb6f2593 100644
--- a/rowers/idoklad.py
+++ b/rowers/idoklad.py
@@ -59,10 +59,15 @@ def idoklad_token():
response = requests.post('https://identity.idoklad.cz/server/connect/token', headers=headers, data=data)
if response.status_code == 200:
- token = response.json()
- token['updated_at'] = timezone.now()
- token = iDokladToken.objects.filter(id=1).update(**token)
- return iDokladToken.objects.get(id=1)
+ token_json = response.json()
+ token = iDokladToken.objects.all().order_by('-updated_at')[0]
+ token.access_token = token_json['access_token']
+ token.id_token = token_json['id_token']
+ token.refresh_token = token_json['refresh_token']
+ token.expires_in = token_json['expires_in']
+ token.updated_at = timezone.now()
+ token.save()
+ return token
else:
return None
diff --git a/rowers/templates/paidplans.html b/rowers/templates/paidplans.html
index 836d4e44..36cc5f20 100644
--- a/rowers/templates/paidplans.html
+++ b/rowers/templates/paidplans.html
@@ -9,7 +9,7 @@
Rowsandall.com offers free data and analysis for rowers, by rowers.
Of course, offering this service is not free. To help cover the
- hosting costs, we have created paid plans offering extended
+ hosting costs, we have created a paid plan offering extended
functionality.
@@ -25,9 +25,6 @@
BASIC
PRO
- SELF-COACH
- COACH
- Free COACH
@@ -35,146 +32,92 @@
Basic rowing metrics (spm, time, distance, heart rate, power)
✔
✔
- ✔
- ✔
- ✔
Manual Import, Export, Synchronization and download of all your data
✔
✔
- ✔
- ✔
- ✔
Heart rate and power zones
✔
✔
- ✔
- ✔
- ✔
+ Ranking Pieces, Stroke Analysis
✔
✔
+
+
+ Compare Workouts
✔
✔
+
+
Automatic Synchronization with other fitness sites
+ ✔
✔
- All other rowing metrics (Work per Stroke, Average and Peak Force, Drive Length, Catch and Finish Angle, Slip and Wash, Peak Force Angle, and more)
✔
- ✔
- ✔
- ✔
-
-
Automatic Synchronization with other fitness sites
-
- ✔
- ✔
- ✔
-
- Advanced Analysis (Critical Power, Stats, Box Chart, Trend Flex)
✔
- ✔
- ✔
- ✔*
-
-
Compare Workouts
-
- ✔
- ✔
- ✔
- ✔*
Empower Stroke Profile
✔
- ✔
- ✔
- ✔*
Sensor Fusion, Split Workout, In-stroke metrics
✔
- ✔
- ✔
- ✔*
Create and manage groups.
- ✔ (max 1)
- ✔ (max 1)
- ✔
✔
Create Training plans, tests and challenges for yourself and your training group. Track your performance
against plan.
-
✔
- ✔
-
Create Training plans, tests and challenges for your athletes. Track their performance
against plan.
-
-
- ✔
✔
Manage your athlete's workouts
-
-
- ✔
✔
Run analytics for your athletes
-
-
✔
- ✔*
Change zone intensities and other workout related settings for your athletes
-
-
- ✔
✔
Pricing
FREE
From 25€/year
- From 75€/year
- From 90€/year
- Free
{% if rower %}
-
-
-
@@ -193,27 +136,11 @@
{% endif %}
-
{% endif %}
- {% if rower.rowerplan == 'plan' %}
-
- SELF-COACH ({{ rower.paymenttype }})
- {% else %}
-
- {% endif %}
-
- {% if rower.rowerplan == 'coach' %}
-
COACH ({{ rower.paymenttype }})
- {% elif rower.rowerplan == 'freecoach' %}
- Free COACH
- {% else %}
-
- {% endif %}
-
- Available trials (no strings attached)
+ Available trial (no strings attached)
@@ -231,40 +158,6 @@
{% endif %}
-
- {% if user.is_anonymous %}
-
- {% elif rower and rower.rowerplan == 'basic' and rower.plantrialexpires|date_dif == 1 %}
-
- {% elif rower and rower.rowerplan == 'pro' and rower.plantrialexpires|date_dif == 1 %}
-
- {% else %}
-
- {% endif %}
-
-
- {% if user.is_anonymous %}
-
- {% elif rower and rower.rowerplan == 'basic' and rower.coachtrialexpires|date_dif == 1 %}
-
- {% elif rower and rower.rowerplan == 'pro' and rower.coachtrialexpires|date_dif == 1 %}
-
- {% else %}
-
- {% endif %}
-
@@ -289,79 +182,16 @@
{% endif %}
- {% elif rower and rower.rowerplan == 'freecoach' %}
-
-
-
- {% elif rower and rower.rowerplan == 'pro' %}
-
-
-
-
- {% elif rower and rower.rowerplan == 'plan' %}
-
-
-
-
-
-
-
-
{% endif %}
Rowsandall.com's Training Planning functionality - is part of the paid "Self-Coach" and "Coach" plans.
- -On the "Self-Coach" plan, you can plan your own sessions.
- -On the "Coach" plan, you can establish teams, see workouts done by - athletes on your team, and plan individual and group sessions for your - athletes. +
+ Payment methods: We accept credit card payments and PayPal through Braintree.
-The Coach plan functionality listed is available to the coach only. - Individual athletes - can purchase upgrades to "Pro" and "Self-Coach" plans. -
- -- The Coach plans come in two versions: free and paid. On the free coach plan, - you can only have athletes who are on the PRO paid plans or higher, and you - cannot upload any workouts to your own account. Some of the advanced Analysis functionality - becomes available when the athlete group is larger than 4. - On the paid - plans, your athletes can be on the free plan, and you have full access to the - site functionality for your own workouts and those of your athletes. -
- -If you would like to find a coach who helps you plan your training - through rowsandall.com, contact me throught the contact form.
-
diff --git a/rowers/tests/test_analysis.py b/rowers/tests/test_analysis.py
index c2bd1f89..a6d6533d 100644
--- a/rowers/tests/test_analysis.py
+++ b/rowers/tests/test_analysis.py
@@ -21,7 +21,7 @@ class ListWorkoutTest(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
@@ -80,7 +80,7 @@ class PlannedSessionTests(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
@@ -135,7 +135,7 @@ class ForcecurveTest(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
@@ -275,7 +275,7 @@ class WorkoutCompareTestNew(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
@@ -377,7 +377,7 @@ class WorkoutBoxPlotTestNew(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
@@ -478,7 +478,7 @@ class WorkoutHistoTestNew(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
@@ -579,7 +579,7 @@ class History(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(20, user=self.r)
@@ -670,7 +670,7 @@ class GoldMedalScores(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(20, user=self.r)
@@ -774,7 +774,7 @@ class WorkoutFlexallTestNew(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
@@ -875,7 +875,7 @@ class WorkoutStatsTestNew(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
@@ -1188,7 +1188,7 @@ class MarkerPerformanceTest(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
@@ -1366,7 +1366,7 @@ class AlertTest(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
diff --git a/rowers/tests/test_payments.py b/rowers/tests/test_payments.py
index 0ecd7776..ca1bb30a 100644
--- a/rowers/tests/test_payments.py
+++ b/rowers/tests/test_payments.py
@@ -183,7 +183,7 @@ description: ""
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach',
+ rowerplan='pro',
paymentprocessor='braintree',
street_address=faker.street_address(),
city=faker.city(),
@@ -242,7 +242,7 @@ description: ""
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach',
+ rowerplan='pro',
paymentprocessor='braintree',
street_address=faker.street_address(),
city=faker.city(),
@@ -306,7 +306,7 @@ description: ""
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach',
+ rowerplan='pro',
paymentprocessor='braintree',
street_address=faker.street_address(),
city=faker.city(),
@@ -373,7 +373,7 @@ description: ""
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach',
+ rowerplan='pro',
paymentprocessor='braintree',
street_address=faker.street_address(),
city=faker.city(),
@@ -507,7 +507,7 @@ description: ""
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach',
+ rowerplan='pro',
paymentprocessor='braintree',
street_address=faker.street_address(),
city=faker.city(),
@@ -548,7 +548,7 @@ description: ""
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach',
+ rowerplan='pro',
paymentprocessor='braintree',
street_address=faker.street_address(),
city=faker.city(),
@@ -570,7 +570,7 @@ description: ""
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach',
+ rowerplan='pro',
paymentprocessor='braintree',
street_address=faker.street_address(),
city=faker.city(),
@@ -617,7 +617,7 @@ description: ""
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach',
+ rowerplan='pro',
paymentprocessor='braintree',
street_address=faker.street_address(),
city=faker.city(),
@@ -663,7 +663,7 @@ description: ""
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach',
+ rowerplan='pro',
paymentprocessor='braintree',
street_address=faker.street_address(),
city=faker.city(),
@@ -708,7 +708,7 @@ description: ""
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach',
+ rowerplan='pro',
paymentprocessor='braintree',
street_address=faker.street_address(),
city=faker.city(),
@@ -759,7 +759,7 @@ description: ""
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach',
+ rowerplan='pro',
paymentprocessor='braintree',
street_address=faker.street_address(),
city=faker.city(),
diff --git a/rowers/tests/test_rowerplans.py b/rowers/tests/test_rowerplans.py
index e662bf2c..9e311f6e 100644
--- a/rowers/tests/test_rowerplans.py
+++ b/rowers/tests/test_rowerplans.py
@@ -41,28 +41,7 @@ class TrialsTest(TestCase):
self.r.protrialexpires = (nu+datetime.timedelta(days=10)).date()
self.r.save()
- self.assertEqual(isplanmember(self.u),False)
- self.assertEqual(iscoachmember(self.u),False)
- self.assertEqual(ispromember(self.u),True)
-
- self.r.plantrialexpires = (nu+datetime.timedelta(days=10)).date()
- self.r.save()
-
self.assertEqual(isplanmember(self.u),True)
- self.assertEqual(iscoachmember(self.u),False)
+ self.assertEqual(iscoachmember(self.u),True)
self.assertEqual(ispromember(self.u),True)
- def test_protrial(self):
- self.r.rowerplan = 'pro'
- self.r.save()
- self.assertEqual(isplanmember(self.u),False)
- self.assertEqual(iscoachmember(self.u),False)
- self.assertEqual(ispromember(self.u),True)
-
- self.r.plantrialexpires = (nu+datetime.timedelta(days=10)).date()
- self.r.save()
-
- self.assertEqual(is_plantrial(self.u),True)
- self.assertEqual(isplanmember(self.u),True)
- self.assertEqual(iscoachmember(self.u),False)
- self.assertEqual(ispromember(self.u),True)
diff --git a/rowers/tests/test_urls.py b/rowers/tests/test_urls.py
index 829f7864..5e30c26c 100644
--- a/rowers/tests/test_urls.py
+++ b/rowers/tests/test_urls.py
@@ -25,7 +25,7 @@ class URLTests(TestCase):
'sander@ds.ds',
'koeinsloot',
)
- r = Rower.objects.create(user=u,rowerplan='coach',gdproptin=True, ftpset=True,
+ r = Rower.objects.create(user=u,rowerplan='pro',gdproptin=True, ftpset=True,
gdproptindate=timezone.now())
self.c = Client()
cs = courses.kmltocourse('rowers/tests/testdata/thyro.kml')
diff --git a/rowers/tests/testdata/testdata.tcx.gz b/rowers/tests/testdata/testdata.tcx.gz
index d32442bdfad1513efff64a87f97d5d251e26d5be..54dd88b62606f587f5c75f6ce4cb4439eb49f51b 100644
GIT binary patch
delta 15
WcmbO#KUJPhzMF$%($tM?{rmtVtOTV1
delta 15
WcmbO#KUJPhzMF%iIBFwXKR*B>%LGdR
From 2759fd56eb2e3b78cfe75af35071496906333974 Mon Sep 17 00:00:00 2001
From: Sander Roosendaal ✔
-
All other rowing metrics (Work per Stroke, Average and Peak Force, Drive Length, Catch and Finish Angle, Slip and Wash, Peak Force Angle, and more)
-
+ Advanced Analysis (Critical Power, Stats, Box Chart, Trend Flex)
+ ✔
✔
-
Advanced Analysis (Critical Power, Stats, Box Chart, Trend Flex)
-
+ All other rowing metrics (Work per Stroke, Average and Peak Force, Drive Length, Catch and Finish Angle, Slip and Wash, Peak Force Angle, and more)
+ partly
✔
diff --git a/rowers/tests/test_aavirtualevents.py b/rowers/tests/test_aavirtualevents.py
index 92e978fd..7c4b3836 100644
--- a/rowers/tests/test_aavirtualevents.py
+++ b/rowers/tests/test_aavirtualevents.py
@@ -22,7 +22,7 @@ class VirtualEventViewTest(MyTestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True, surveydone=True,gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.c = Client()
diff --git a/rowers/tests/test_api.py b/rowers/tests/test_api.py
index 14f0429a..6a460a81 100644
--- a/rowers/tests/test_api.py
+++ b/rowers/tests/test_api.py
@@ -56,7 +56,7 @@ class StravaPrivacy(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach',subscription_id=1)
+ rowerplan='pro',subscription_id=1)
self.r.stravatoken = '12'
self.r.stravarefreshtoken = '123'
@@ -77,7 +77,7 @@ class StravaPrivacy(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach',clubsize=3)
+ rowerplan='pro',clubsize=3)
self.r3 = Rower.objects.create(user=self.u3,
birthdate=faker.profile()['birthdate'],
diff --git a/rowers/tests/test_async_tasks.py b/rowers/tests/test_async_tasks.py
index f7af8923..7833de30 100644
--- a/rowers/tests/test_async_tasks.py
+++ b/rowers/tests/test_async_tasks.py
@@ -32,7 +32,7 @@ class AsyncTaskTests(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
diff --git a/rowers/tests/test_aworkouts.py b/rowers/tests/test_aworkouts.py
index c18a60bd..a323aa19 100644
--- a/rowers/tests/test_aworkouts.py
+++ b/rowers/tests/test_aworkouts.py
@@ -39,7 +39,7 @@ class ListWorkoutTest(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
@@ -144,7 +144,7 @@ class WorkoutViewTest(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.c = Client()
self.c2 = Client() # for anonymous
diff --git a/rowers/tests/test_braintree.py b/rowers/tests/test_braintree.py
index 3d32d19c..88654e4b 100644
--- a/rowers/tests/test_braintree.py
+++ b/rowers/tests/test_braintree.py
@@ -67,7 +67,7 @@ class BraintreeUnits(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach',subscription_id=1)
+ rowerplan='pro',subscription_id=1)
self.pp = PaidPlan.objects.create(price=0,paymentprocessor='braintree')
diff --git a/rowers/tests/test_courses.py b/rowers/tests/test_courses.py
index 346cca15..753b6fe1 100644
--- a/rowers/tests/test_courses.py
+++ b/rowers/tests/test_courses.py
@@ -18,7 +18,7 @@ class CourseUnitTest(TestCase):
'koeinsloot')
self.r = Rower.objects.create(user=self.u,gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach',
+ rowerplan='pro',
)
self.nu = datetime.datetime.now()
@@ -130,7 +130,7 @@ class CoursesTest(TestCase):
'koeinsloot')
self.r = Rower.objects.create(user=self.u,gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach',
+ rowerplan='pro',
)
self.nu = datetime.datetime.now()
diff --git a/rowers/tests/test_cpchart.py b/rowers/tests/test_cpchart.py
index 3c6fd404..3c2b771a 100644
--- a/rowers/tests/test_cpchart.py
+++ b/rowers/tests/test_cpchart.py
@@ -23,7 +23,7 @@ class CPChartTest(TestCase):
gdproptin=True, ftpset=True,surveydone=True,sex='male',
weightcategory='hwt',
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
r = self.u.rower
age = calculate_age(r.birthdate)
diff --git a/rowers/tests/test_emails.py b/rowers/tests/test_emails.py
index ae26ef5e..bbf2ea80 100644
--- a/rowers/tests/test_emails.py
+++ b/rowers/tests/test_emails.py
@@ -26,7 +26,7 @@ class EmailUpload(TestCase):
birthdate = faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
nu = datetime.datetime.now()
@@ -208,7 +208,7 @@ class EmailTests(TestCase):
birthdate = faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
nu = datetime.datetime.now()
a2 = 'media/mailbox_attachments/colin3.csv'
diff --git a/rowers/tests/test_empower.py b/rowers/tests/test_empower.py
index ce52ff4e..1ac099b9 100644
--- a/rowers/tests/test_empower.py
+++ b/rowers/tests/test_empower.py
@@ -14,7 +14,7 @@ class EmpowerTest(TestCase):
'sander@ds.ds',
'koeinsloot',
)
- r = Rower.objects.create(user=u,rowerplan='coach',gdproptin=True, ftpset=True,surveydone=True,
+ r = Rower.objects.create(user=u,rowerplan='pro',gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now())
self.c = Client()
diff --git a/rowers/tests/test_flexchart.py b/rowers/tests/test_flexchart.py
index 455eb1d8..50deb370 100644
--- a/rowers/tests/test_flexchart.py
+++ b/rowers/tests/test_flexchart.py
@@ -14,7 +14,7 @@ class WorkoutViewTest(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach',
+ rowerplan='pro',
showfavoritechartnotes=True)
self.c = Client()
diff --git a/rowers/tests/test_imports.py b/rowers/tests/test_imports.py
index f7b3a933..df48f11e 100644
--- a/rowers/tests/test_imports.py
+++ b/rowers/tests/test_imports.py
@@ -47,7 +47,7 @@ class RojaboObjects(DjangoTestCase):
self.r.rojabo_refreshtoken = 'ab'
self.r.rojabo_tokenexpirydate = arrow.get(datetime.datetime.now()+datetime.timedelta(days=1)).datetime
self.r.defaulttimezone = 'Europe/Prague'
- self.r.rowerplan = 'plan'
+ self.r.rowerplan = 'pro'
self.r.save()
self.u2 = User.objects.create_user('john2',
@@ -134,7 +134,7 @@ class GarminObjects(DjangoTestCase):
)
self.r.garmintoken = 'dfdzf'
self.r.garminrefreshtoken = 'fsls'
- self.r.rowerplan = 'plan'
+ self.r.rowerplan = 'pro'
self.r.save()
self.c.login(username='john',password='koeinsloot')
diff --git a/rowers/tests/test_misc.py b/rowers/tests/test_misc.py
index ff841c3e..391a3c86 100644
--- a/rowers/tests/test_misc.py
+++ b/rowers/tests/test_misc.py
@@ -18,7 +18,7 @@ class MiscTests(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach',subscription_id=1)
+ rowerplan='pro',subscription_id=1)
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
diff --git a/rowers/tests/test_permissions.py b/rowers/tests/test_permissions.py
index 4ee00a3b..9e587cdd 100644
--- a/rowers/tests/test_permissions.py
+++ b/rowers/tests/test_permissions.py
@@ -26,7 +26,7 @@ class PlanningPermissionsCoach(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach',
+ rowerplan='pro',
clubsize=10,
)
self.ucoachpassword = faker.word()
@@ -97,184 +97,8 @@ class PlanningPermissionsCoach(TestCase):
def test_coachee_can_sync(self):
self.assertTrue(user_is_coachee(self.ucoachee))
+
-@override_settings(TESTING=True)
-class PermissionsFreeCoach(TestCase):
- def setUp(self):
- self.c = Client()
- ## Users - Pro, Basic, Free Coach & Self Coach
-
- self.ufreecoach = UserFactory(username='coachuser')
- self.rfreecoach = Rower.objects.create(user=self.ufreecoach,
- birthdate=faker.profile()['birthdate'],
- gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
- rowerplan='freecoach',clubsize=100)
-
- self.coachinggroup = CoachingGroup.objects.create()
- self.rfreecoach.mycoachgroup = self.coachinggroup
- self.rfreecoach.save()
- self.factory = RequestFactory()
- self.password = faker.word()
- self.ufreecoach.set_password(self.password)
- self.ufreecoach.save()
-
- self.uplan = UserFactory(username='planuser')
- self.rplan = Rower.objects.create(user=self.uplan,
- birthdate=faker.profile()['birthdate'],
- gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
- rowerplan='plan')
-
- self.uplan_workouts = WorkoutFactory.create_batch(5, user=self.rplan)
- self.factory = RequestFactory()
- self.password = faker.word()
- self.uplan.set_password(self.password)
- self.uplan.save()
-
- self.upro = UserFactory(username='prouser')
- self.rpro = Rower.objects.create(user=self.upro,
- birthdate=faker.profile()['birthdate'],
- gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
- rowerplan='pro')
-
- self.upro_workouts = WorkoutFactory.create_batch(5, user=self.rpro)
- self.factory = RequestFactory()
- self.password = faker.word()
- self.upro.set_password(self.password)
- self.upro.save()
-
- self.uplan2 = UserFactory(username='planuser2')
- self.rplan2 = Rower.objects.create(user=self.uplan2,
- birthdate=faker.profile()['birthdate'],
- gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
- rowerplan='plan')
-
- self.uplan2_workouts = WorkoutFactory.create_batch(5, user=self.rplan2)
- self.factory = RequestFactory()
- self.password = faker.word()
- self.uplan2.set_password(self.password)
- self.uplan2.save()
-
- self.upro2 = UserFactory(username='prouser2')
- self.rpro2 = Rower.objects.create(user=self.upro2,
- birthdate=faker.profile()['birthdate'],
- gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
- rowerplan='pro')
-
- self.upro2_workouts = WorkoutFactory.create_batch(5, user=self.rpro2)
- self.factory = RequestFactory()
- self.password = faker.word()
- self.upro2.set_password(self.password)
- self.upro2.save()
-
- self.ubasic = UserFactory(username='basicuser')
- self.rbasic = Rower.objects.create(user=self.ubasic,
- birthdate=faker.profile()['birthdate'],
- gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
- rowerplan='basic')
-
- self.ubasic_workouts = WorkoutFactory.create_batch(5, user=self.rbasic)
- self.factory = RequestFactory()
- self.ubasicpassword = faker.word()
- self.ubasic.set_password(self.ubasicpassword)
- self.ubasic.save()
-
-
-
- ## TeamFreeCoach
-
- self.teamfreecoach = Team.objects.create(
- name=faker.word()+'3',
- notes=faker.text(),
- manager=self.ufreecoach)
-
- ## Coach can have any number of groups
- def test_coach_groupmanager(self):
- team1 = Team.objects.create(
- name = 'FirstTeam',
- notes = faker.text(),
- manager = self.ufreecoach,
- )
-
- self.assertEqual(team1.manager,self.ufreecoach)
-
- team2 = Team.objects.create(
- name = 'SecondTeam',
- notes = faker.text(),
- manager = self.ufreecoach,
- )
-
- self.assertEqual(team2.manager,self.ufreecoach)
-
-
- team3 = Team.objects.create(
- name = 'ThirdTeam',
- notes = faker.text(),
- manager = self.ufreecoach,
- )
-
- self.assertEqual(team3.manager,self.ufreecoach)
-
-
-
- ## Free coach can create more than one group
- def test_plan_groupmanager(self):
- team1 = Team.objects.create(
- name = 'FirstTeam',
- notes = faker.text(),
- manager = self.ufreecoach,
- )
-
- self.assertEqual(team1.manager,self.ufreecoach)
-
- team2 = Team.objects.create(
- name = 'SecondTeam',
- notes = faker.text(),
- manager = self.ufreecoach,
- )
-
- self.assertEqual(team2.manager,self.ufreecoach)
-
-
-
- ## Free Coach can create planned sessions and team planned sessions
- ## Self Coach and higher can create planned sessions and team planned sessions
- def test_plan_create_session(self):
- ps = PlannedSession.objects.create(
- manager=self.ufreecoach,
- name=faker.word(),
- comment=faker.text()
- )
- self.assertEqual(ps.manager,self.ufreecoach)
-
- def test_coach_create_session(self):
- ps = PlannedSession.objects.create(
- manager=self.ufreecoach,
- name=faker.word(),
- comment=faker.text()
- )
- self.assertEqual(ps.manager,self.ufreecoach)
-
-
- ## Basic cannot join groups led by Free Coach
- def test_add_basic_pro_or_plan(self):
- with transaction.atomic():
- with self.assertRaises(ValidationError):
- self.rbasic.team.add(self.teamfreecoach)
-
-
- ## Free Coach user cannot have workouts
- def test_add_workout_freecoach(self):
- result = get_random_file(filename='rowers/tests/testdata/erg1.csv')
- with transaction.atomic():
- with self.assertRaises(ValidationError):
- self.werg1 = WorkoutFactory(user=self.rfreecoach,
- csvfilename=result['filename'],
- starttime=result['starttime'],
- startdatetime=result['startdatetime'],
- duration=result['duration'],
- distance=result['totaldist'],
- workouttype = 'rower',
- )
@override_settings(TESTING=True)
class PermissionsBasicsTests(TestCase):
@@ -286,7 +110,7 @@ class PermissionsBasicsTests(TestCase):
self.rcoach = Rower.objects.create(user=self.ucoach,
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
- rowerplan='coach',clubsize=10)
+ rowerplan='pro',clubsize=10)
self.ucoach_workouts = WorkoutFactory.create_batch(5, user=self.rcoach)
self.coachinggroup = CoachingGroup.objects.create()
@@ -301,7 +125,7 @@ class PermissionsBasicsTests(TestCase):
self.rplan = Rower.objects.create(user=self.uplan,
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
- rowerplan='plan')
+ rowerplan='pro')
self.uplan_workouts = WorkoutFactory.create_batch(5, user=self.rplan)
self.factory = RequestFactory()
@@ -325,7 +149,7 @@ class PermissionsBasicsTests(TestCase):
self.rplan2 = Rower.objects.create(user=self.uplan2,
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
- rowerplan='plan')
+ rowerplan='pro')
self.uplan2_workouts = WorkoutFactory.create_batch(5, user=self.rplan2)
self.factory = RequestFactory()
@@ -341,7 +165,7 @@ class PermissionsBasicsTests(TestCase):
self.upro2_workouts = WorkoutFactory.create_batch(5, user=self.rpro2)
self.factory = RequestFactory()
- self.password = faker.word()
+ self.upro2password = faker.word()
self.upro2.set_password(self.password)
self.upro2.save()
@@ -366,15 +190,6 @@ class PermissionsBasicsTests(TestCase):
notes=faker.text(),
manager=self.upro2)
- self.teamplan = Team.objects.create(
- name=faker.word()+'2',
- notes=faker.text(),
- manager=self.uplan2)
-
- self.teamcoach = Team.objects.create(
- name=faker.word()+'3',
- notes=faker.text(),
- manager=self.ucoach)
# Requirements
@@ -411,12 +226,11 @@ class PermissionsBasicsTests(TestCase):
## Basic athletes can be member of Coach led group
def test_add_coach(self):
- self.rbasic.team.add(self.teamcoach)
- self.assertIn(self.teamcoach,self.rbasic.team.all())
+ self.rbasic.team.add(self.teampro)
+ self.assertIn(self.teampro,self.rbasic.team.all())
- ## Self coach can create one group
- ## Self coach cannot create more than one group
+ ## Pro member can create more than one group
def test_plan_groupmanager(self):
team1 = Team.objects.create(
name = 'FirstTeam',
@@ -426,32 +240,24 @@ class PermissionsBasicsTests(TestCase):
self.assertEqual(team1.manager,self.uplan)
- with self.assertRaises(ValidationError):
- team2 = Team.objects.create(
- name = 'SecondTeam',
- notes = faker.text(),
- manager = self.uplan,
- )
+ team2 = Team.objects.create(
+ name = 'SecondTeam',
+ notes = faker.text(),
+ manager = self.uplan,
+ )
+
+ self.assertEqual(team2.manager,self.uplan)
## Pro users (and higher) can join group led by other Pro (or higher) user
def test_add_proplan_pro_or_plan(self):
- self.rpro.team.add(self.teamplan)
- self.assertIn(self.teamplan,self.rpro.team.all())
-
self.rpro.team.add(self.teampro)
self.assertIn(self.teampro,self.rpro.team.all())
- self.rplan.team.add(self.teamplan)
- self.assertIn(self.teamplan,self.rplan.team.all())
-
self.rplan.team.add(self.teampro)
self.assertIn(self.teampro,self.rplan.team.all())
- self.rcoach.team.add(self.teamplan)
- self.assertIn(self.teamplan,self.rcoach.team.all())
-
self.rcoach.team.add(self.teampro)
self.assertIn(self.teampro,self.rcoach.team.all())
@@ -476,8 +282,7 @@ class PermissionsBasicsTests(TestCase):
)
self.assertEqual(ps.manager,self.ucoach)
- ## Pro can have one group
- ## Pro cannot create more than one group
+ ## Pro can have more than one group
def test_pro_groupmanager(self):
team1 = Team.objects.create(
name = 'FirstTeam',
@@ -487,22 +292,23 @@ class PermissionsBasicsTests(TestCase):
self.assertEqual(team1.manager,self.upro)
- with self.assertRaises(ValidationError):
- team2 = Team.objects.create(
- name = 'SecondTeam',
- notes = faker.text(),
- manager = self.upro,
- )
+ team2 = Team.objects.create(
+ name = 'SecondTeam',
+ notes = faker.text(),
+ manager = self.upro,
+ )
+ self.assertEqual(team2.manager,self.upro)
- ## Pro or Basic cannot create planned sessions or team planned sessions
+ ## Basic cannot create planned sessions or team planned sessions
def test_pro_create_plannedsession(self):
- with self.assertRaises(ValidationError):
- ps = PlannedSession.objects.create(
- manager=self.upro,
- name = faker.word(),
- comment = faker.text()
- )
+ ps = PlannedSession.objects.create(
+ manager=self.upro,
+ name = faker.word(),
+ comment = faker.text()
+ )
+
+ self.assertEqual(ps.manager,self.upro)
def test_basic_create_plannedsession(self):
with self.assertRaises(ValidationError):
@@ -512,15 +318,6 @@ class PermissionsBasicsTests(TestCase):
comment = faker.text()
)
- ## Basic cannot join groups led by Pro or Self Coach
- def test_add_basic_pro_or_plan(self):
- with transaction.atomic():
- with self.assertRaises(ValidationError):
- self.rbasic.team.add(self.teamplan)
-
- with transaction.atomic():
- with self.assertRaises(ValidationError):
- self.rbasic.team.add(self.teampro)
## Basic cannot manage a group
@@ -546,7 +343,7 @@ class PermissionsViewTests(TestCase):
self.rcoach = Rower.objects.create(user=self.ucoach,
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
- rowerplan='coach',clubsize=10)
+ rowerplan='pro',clubsize=10)
self.ucoach_workouts = WorkoutFactory.create_batch(5, user=self.rcoach)
self.coachinggroup = CoachingGroup.objects.create()
@@ -561,7 +358,7 @@ class PermissionsViewTests(TestCase):
self.rplan = Rower.objects.create(user=self.uplan,
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
- rowerplan='plan')
+ rowerplan='pro')
self.uplan_workouts = WorkoutFactory.create_batch(5, user=self.rplan)
self.factory = RequestFactory()
@@ -585,7 +382,7 @@ class PermissionsViewTests(TestCase):
self.rplan2 = Rower.objects.create(user=self.uplan2,
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
- rowerplan='plan')
+ rowerplan='pro')
self.uplan2_workouts = WorkoutFactory.create_batch(5, user=self.rplan2)
self.factory = RequestFactory()
@@ -628,17 +425,12 @@ class PermissionsViewTests(TestCase):
notes=faker.text(),
manager=self.upro2)
- self.teamplan = Team.objects.create(
- name=faker.word()+'2',
- notes=faker.text(),
- manager=self.uplan2)
self.teamcoach = Team.objects.create(
name=faker.word()+'3',
notes=faker.text(),
manager=self.ucoach)
-
## only ubasic can view ubasic_workouts[0] which is private
def test_view_workout(self):
login = self.c.login(username=self.ucoach.username, password=self.ucoachpassword)
@@ -756,7 +548,7 @@ class PermissionsViewTests(TestCase):
## Coach can edit on behalf of athlete if permitted
# 1, Preferences
def test_coach_edit_athlete_prefs(self):
- self.rbasic.team.add(self.teamcoach)
+ self.rbasic.team.add(self.teampro)
self.rbasic.coachinggroups.add(self.coachinggroup)
login = self.c.login(username=self.ucoach.username, password=self.ucoachpassword)
@@ -768,7 +560,7 @@ class PermissionsViewTests(TestCase):
self.assertEqual(response.status_code,200)
def test_coach_edit_athlete_prefs_not(self):
- self.rbasic.team.add(self.teamcoach)
+ self.rbasic.team.add(self.teampro)
login = self.c.login(username=self.ucoach.username, password=self.ucoachpassword)
self.assertTrue(login)
@@ -780,7 +572,7 @@ class PermissionsViewTests(TestCase):
# 2, Favorite Charts
def test_coach_edit_athlete_settings(self):
- self.rbasic.team.add(self.teamcoach)
+ self.rbasic.team.add(self.teampro)
self.rbasic.coachinggroups.add(self.coachinggroup)
login = self.c.login(username=self.ucoach.username, password=self.ucoachpassword)
@@ -792,7 +584,7 @@ class PermissionsViewTests(TestCase):
self.assertEqual(response.status_code,200)
def test_coach_edit_athlete_settings_not(self):
- self.rbasic.team.add(self.teamcoach)
+ self.rbasic.team.add(self.teampro)
login = self.c.login(username=self.ucoach.username, password=self.ucoachpassword)
self.assertTrue(login)
@@ -804,7 +596,7 @@ class PermissionsViewTests(TestCase):
# 3, Export Settings
def test_coach_edit_athlete_exportsettings(self):
- self.rbasic.team.add(self.teamcoach)
+ self.rbasic.team.add(self.teampro)
self.rbasic.coachinggroups.add(self.coachinggroup)
login = self.c.login(username=self.ucoach.username, password=self.ucoachpassword)
@@ -816,7 +608,7 @@ class PermissionsViewTests(TestCase):
self.assertEqual(response.status_code,200)
def test_coach_edit_athlete_exportsettings_not(self):
- self.rbasic.team.add(self.teamcoach)
+ self.rbasic.team.add(self.teampro)
login = self.c.login(username=self.ucoach.username, password=self.ucoachpassword)
self.assertTrue(login)
@@ -828,7 +620,7 @@ class PermissionsViewTests(TestCase):
# 4, Account settings
def test_coach_edit_athlete_account(self):
- self.rbasic.team.add(self.teamcoach)
+ self.rbasic.team.add(self.teampro)
self.rbasic.coachinggroups.add(self.coachinggroup)
login = self.c.login(username=self.ucoach.username, password=self.ucoachpassword)
@@ -840,7 +632,7 @@ class PermissionsViewTests(TestCase):
self.assertEqual(response.status_code,200)
def test_coach_edit_athlete_account_not(self):
- self.rbasic.team.add(self.teamcoach)
+ self.rbasic.team.add(self.teampro)
login = self.c.login(username=self.ucoach.username, password=self.ucoachpassword)
self.assertTrue(login)
@@ -853,7 +645,7 @@ class PermissionsViewTests(TestCase):
## Coach can run analytics for athlete
@patch('rowers.dataprep.read_cols_df_sql', side_effect = mocked_read_df_cols_sql_multistats)
def test_coach_edit_athlete_analysis(self,mocked_df):
- self.rbasic.team.add(self.teamcoach)
+ self.rbasic.team.add(self.teampro)
self.rbasic.coachinggroups.add(self.coachinggroup)
login = self.c.login(username=self.ucoach.username, password=self.ucoachpassword)
@@ -874,7 +666,7 @@ class PermissionsViewTests(TestCase):
@patch('rowers.dataprep.read_cols_df_sql', side_effect = mocked_read_df_cols_sql_multistats)
def test_coach_edit_athlete_analysis_not(self,mocked_df):
- self.rbasic.team.add(self.teamcoach)
+ self.rbasic.team.add(self.teampro)
login = self.c.login(username=self.ucoach.username, password=self.ucoachpassword)
self.assertTrue(login)
@@ -892,7 +684,7 @@ class PermissionsViewTests(TestCase):
@patch('rowers.dataprep.read_cols_df_sql', side_effect = mocked_read_df_cols_sql_multistats)
def test_coach_edit_athlete_analysis_not2(self,mocked_df):
- self.rbasic.team.add(self.teamcoach)
+ self.rbasic.team.add(self.teampro)
login = self.c.login(username=self.ucoach.username, password=self.ucoachpassword)
self.assertTrue(login)
@@ -961,7 +753,7 @@ class PermissionsViewTests(TestCase):
def test_coach_edit_athlete_uploadnot(self,mocked_sqlalchemy,mocked_read_data):
self.rbasic.team.add(self.teamcoach)
- login = self.c.login(username=self.ucoach.username, password=self.ucoachpassword)
+ login = self.c.login(username=self.upro2.username, password=self.upro2password)
self.assertTrue(login)
url = reverse('team_workout_upload_view')
@@ -1001,9 +793,9 @@ class PermissionsViewTests(TestCase):
## Coach can edit athlete's workout
def test_coach_edit_athlete_workout(self):
- self.rbasic.team.add(self.teamcoach)
+ self.rbasic.team.add(self.teampro)
- login = self.c.login(username=self.ucoach.username, password=self.ucoachpassword)
+ login = self.c.login(username=self.upro2.username, password=self.upro2password)
self.assertTrue(login)
url = reverse('workout_edit_view',
@@ -1015,9 +807,11 @@ class PermissionsViewTests(TestCase):
## Coach can see list of workouts of athlete
def test_coach_athlete_workout_list(self):
- self.rbasic.team.add(self.teamcoach)
+ self.rbasic.team.add(self.teampro)
+ # check if rbasic is in teampro
+ self.assertIn(self.teampro,self.rbasic.team.all())
- login = self.c.login(username=self.ucoach.username, password=self.ucoachpassword)
+ login = self.c.login(username=self.upro2.username, password=self.upro2password)
self.assertTrue(login)
url = reverse('workouts_view',
@@ -1137,7 +931,7 @@ class PermissionsViewTests(TestCase):
## Self Coach cannot edit on behalf of athlete
def test_plan_edit_athlete_settings(self):
- self.rpro.team.add(self.teamplan)
+ self.rpro.team.add(self.teampro)
login = self.c.login(username=self.uplan2.username, password=self.uplan2password)
self.assertTrue(login)
@@ -1145,12 +939,12 @@ class PermissionsViewTests(TestCase):
url = reverse('rower_prefs_view',kwargs={'userid':self.ubasic.id})
response = self.c.get(url)
- self.assertEqual(response.status_code,403)
+ self.assertEqual(response.status_code,200)
## Self Coach cannot run analytics on behalf of athlete
@patch('rowers.dataprep.read_cols_df_sql', side_effect = mocked_read_df_cols_sql_multistats)
def test_plan_edit_athlete_analysis(self,mocked_df):
- self.rpro.team.add(self.teamplan)
+ self.rpro.team.add(self.teampro)
login = self.c.login(username=self.uplan2.username, password=self.uplan2password)
self.assertTrue(login)
@@ -1164,13 +958,13 @@ class PermissionsViewTests(TestCase):
response = self.c.get(url)
- self.assertEqual(response.status_code,403)
+ self.assertEqual(response.status_code,200)
## Self Coach cannot upload on behalf of athlete
@patch('rowers.dataprep.create_engine')
@patch('rowers.dataprep.read_data',side_effect=mocked_read_data)
def test_plan_edit_athlete_upload(self,mocked_sqlalchemy,mocked_read_data):
- self.rpro.team.add(self.teamplan)
+ self.rpro.team.add(self.teampro)
login = self.c.login(username=self.uplan2.username, password=self.uplan2password)
self.assertTrue(login)
@@ -1178,11 +972,10 @@ class PermissionsViewTests(TestCase):
url = reverse('team_workout_upload_view')
response = self.c.get(url)
- self.assertEqual(response.status_code,403)
+ self.assertEqual(response.status_code,200)
- ## Pro can have one group
- ## Pro cannot create more than one group
+ ## Pro can have more than one group
def test_pro_groups_create(self):
login = self.c.login(username=self.upro.username, password=self.upropassword)
self.assertTrue(login)
@@ -1228,7 +1021,7 @@ class PermissionsViewTests(TestCase):
self.assertTrue(form.is_valid())
- expected_url = reverse('paidplans_view')
+ expected_url = reverse('rower_teams_view')
response = self.c.post(url,form_data,follow=True)
self.assertRedirects(response,
@@ -1289,75 +1082,11 @@ class PermissionsViewTests(TestCase):
self.assertEqual(response.status_code,403)
- ## Self Coach cannot upload on behalf of athlete
- @patch('rowers.dataprep.create_engine')
- @patch('rowers.dataprep.read_data',side_effect=mocked_read_data)
- def test_plan_edit_athlete_upload(self,mocked_sqlalchemy,mocked_read_data):
- self.rpro.team.add(self.teamplan)
-
- login = self.c.login(username=self.uplan2.username, password=self.uplan2password)
- self.assertTrue(login)
-
- url = reverse('team_workout_upload_view')
-
- response = self.c.get(url,follow=True)
- self.assertEqual(response.status_code,200)
-
- expected_url = reverse('paidplans_view')
- self.assertRedirects(response,
- expected_url = expected_url,
- status_code=302,target_status_code=200)
-
-
- ## Pro users can see team members' workout, but not edit
- def test_pro_edit_athlete_workout(self):
- self.rpro.team.add(self.teampro)
- self.rpro2.team.add(self.teampro)
-
- login = self.c.login(username=self.upro2.username, password=self.upro2password)
- self.assertTrue(login)
-
- url = reverse('workout_edit_view',
- kwargs={'id':encoder.encode_hex(self.upro_workouts[0].id)}
- )
-
- response = self.c.get(url)
- self.assertEqual(response.status_code,403)
-
- url = reverse('workout_view',
- kwargs={'id':encoder.encode_hex(self.upro_workouts[0].id)}
- )
-
- response = self.c.get(url)
- self.assertEqual(response.status_code,200)
-
-
- ## Self Coach users can see team members' workout, but not edit
- def test_plan_edit_athlete_workout(self):
- self.rpro.team.add(self.teamplan)
-
- login = self.c.login(username=self.uplan2.username, password=self.uplan2password)
- self.assertTrue(login)
-
- url = reverse('workout_edit_view',
- kwargs={'id':encoder.encode_hex(self.ubasic_workouts[0].id)}
- )
-
- response = self.c.get(url)
- self.assertEqual(response.status_code,403)
-
- url = reverse('workout_view',
- kwargs={'id':encoder.encode_hex(self.ubasic_workouts[0].id)}
- )
-
- response = self.c.get(url)
- self.assertEqual(response.status_code,200)
-
## Basic users can see team members' workout, but not edit
def test_basic_edit_athlete_workout(self):
- self.rbasic.team.add(self.teamcoach)
- self.rplan2.team.add(self.teamcoach)
+ self.rbasic.team.add(self.teampro)
+ self.rplan2.team.add(self.teampro)
login = self.c.login(username=self.ubasic.username, password=self.ubasicpassword)
self.assertTrue(login)
@@ -1421,7 +1150,7 @@ class PermissionsViewTests(TestCase):
expected_url = expected_url,
status_code=302,target_status_code=200)
- ## Basic cannot join groups from Pro or Self Coach users (redirects to paid plans)
+ ## Basic can join groups from Pro
def test_team_member_request_basic_pro(self):
login = self.c.login(username=self.ubasic.username,password=self.ubasicpassword)
self.assertTrue(login)
@@ -1435,12 +1164,12 @@ class PermissionsViewTests(TestCase):
response = self.c.get(url,follow=True)
self.assertEqual(response.status_code,200)
- expected_url = reverse('paidplans_view')
+ expected_url = reverse('team_view',kwargs={'team_id':self.teampro.id})
+
self.assertRedirects(response,
expected_url = expected_url,
status_code=302,target_status_code=200)
-
@override_settings(TESTING=True)
class PermissionsCoachingTests(TestCase):
def setUp(self):
@@ -1451,7 +1180,7 @@ class PermissionsCoachingTests(TestCase):
self.rcoach = Rower.objects.create(user=self.ucoach,
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
- rowerplan='coach',clubsize=10)
+ rowerplan='pro',clubsize=10)
self.ucoach_workouts = WorkoutFactory.create_batch(5, user=self.rcoach)
self.coachinggroup = CoachingGroup.objects.create()
@@ -1466,7 +1195,7 @@ class PermissionsCoachingTests(TestCase):
self.rplan = Rower.objects.create(user=self.uplan,
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
- rowerplan='plan')
+ rowerplan='pro')
self.uplan_workouts = WorkoutFactory.create_batch(5, user=self.rplan)
self.factory = RequestFactory()
@@ -1490,7 +1219,7 @@ class PermissionsCoachingTests(TestCase):
self.rplan2 = Rower.objects.create(user=self.uplan2,
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,gdproptindate=timezone.now(),
- rowerplan='plan')
+ rowerplan='pro')
self.uplan2_workouts = WorkoutFactory.create_batch(5, user=self.rplan2)
self.factory = RequestFactory()
@@ -1524,22 +1253,13 @@ class PermissionsCoachingTests(TestCase):
- ## TeamPro, TeamCoach, TeamSelfCoach
+ ## TeamPro, Teampro, TeamSelfCoach
self.teampro = Team.objects.create(
name=faker.word()+'1',
notes=faker.text(),
manager=self.upro2)
- self.teamplan = Team.objects.create(
- name=faker.word()+'2',
- notes=faker.text(),
- manager=self.uplan2)
-
- self.teamcoach = Team.objects.create(
- name=faker.word()+'3',
- notes=faker.text(),
- manager=self.ucoach)
def test_athlete_request_athlete_revoke(self):
login = self.c.login(username=self.ubasic.username,password=self.ubasicpassword)
diff --git a/rowers/tests/test_races.py b/rowers/tests/test_races.py
index 4b7ca70a..c3cf8f52 100644
--- a/rowers/tests/test_races.py
+++ b/rowers/tests/test_races.py
@@ -60,7 +60,7 @@ class ChallengesTest(TestCase):
birthdate=datetime.datetime.now()-datetime.timedelta(days=25*365),
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.u2 = UserFactory()
self.r2 = Rower.objects.create(user=self.u2,
@@ -1089,7 +1089,7 @@ class IndoorChallengesTest(TestCase):
birthdate=datetime.datetime.now()-datetime.timedelta(days=25*365),
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
diff --git a/rowers/tests/test_simplefunctions.py b/rowers/tests/test_simplefunctions.py
index 59753174..b45c7ad9 100644
--- a/rowers/tests/test_simplefunctions.py
+++ b/rowers/tests/test_simplefunctions.py
@@ -42,7 +42,7 @@ class SimpleViewTest(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True, surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
diff --git a/rowers/tests/test_team.py b/rowers/tests/test_team.py
index 9deb3639..28bdce90 100644
--- a/rowers/tests/test_team.py
+++ b/rowers/tests/test_team.py
@@ -43,7 +43,7 @@ class TeamTest(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach',
+ rowerplan='pro',
user=u,
clubsize=3
)
@@ -402,7 +402,7 @@ class TeamTestLowLevel(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach',
+ rowerplan='pro',
user=u,
clubsize=3
)
diff --git a/rowers/tests/test_unit_tests.py b/rowers/tests/test_unit_tests.py
index 2546d575..bdd23a6f 100644
--- a/rowers/tests/test_unit_tests.py
+++ b/rowers/tests/test_unit_tests.py
@@ -35,7 +35,7 @@ class OtherUnitTests(TestCase):
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
defaulttimezone='US/Pacific',
- rowerplan='coach')
+ rowerplan='pro')
# Test get_dates_timeperiod
@@ -172,7 +172,7 @@ class PlannedSessionTests(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
@@ -430,7 +430,7 @@ class DataPrepTests(TestCase):
gdproptin=True, ftpset=True,surveydone=True,
sex='male',
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.r.birthdate = timezone.now()-datetime.timedelta(days=25*365)
self.r.defaulttimezone = 'Europe/Amsterdam'
@@ -649,7 +649,7 @@ class InteractivePlotTests(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
diff --git a/rowers/tests/test_units.py b/rowers/tests/test_units.py
index b540eeb3..3c627fe3 100644
--- a/rowers/tests/test_units.py
+++ b/rowers/tests/test_units.py
@@ -27,7 +27,7 @@ class ForceUnits(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.user_workouts = WorkoutFactory.create_batch(12, user=self.r)
@@ -171,7 +171,7 @@ class TestForceUnit(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(14, user=self.r)
diff --git a/rowers/tests/test_uploads.py b/rowers/tests/test_uploads.py
index f93418e8..62e6e309 100644
--- a/rowers/tests/test_uploads.py
+++ b/rowers/tests/test_uploads.py
@@ -21,7 +21,7 @@ class ViewTest(TestCase):
'koeinsloot')
self.r = Rower.objects.create(user=self.u,gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach',
+ rowerplan='pro',
)
add_defaultfavorites(self.r)
diff --git a/rowers/tests/test_urls.py b/rowers/tests/test_urls.py
index 5e30c26c..f08b1e9d 100644
--- a/rowers/tests/test_urls.py
+++ b/rowers/tests/test_urls.py
@@ -119,7 +119,6 @@ class URLTests(TestCase):
'/rowers/me/workflowdefault/',
'/rowers/partners/',
'/rowers/physics/',
- '/rowers/planrequired/',
'/rowers/register/',
'/rowers/register/thankyou/',
'/rowers/sessions/',
diff --git a/rowers/tests/test_user.py b/rowers/tests/test_user.py
index 77ed9f00..935bc7bb 100644
--- a/rowers/tests/test_user.py
+++ b/rowers/tests/test_user.py
@@ -82,7 +82,7 @@ class UserPreferencesTest(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True, ftpset=True,surveydone=True,
gdproptindate=timezone.now(),
- rowerplan='coach')
+ rowerplan='pro')
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
diff --git a/rowers/tests/testdata/testdata.tcx.gz b/rowers/tests/testdata/testdata.tcx.gz
index 54dd88b62606f587f5c75f6ce4cb4439eb49f51b..7207adecaddb2e4d4bdf45b1e5695dcf1b3d345f 100644
GIT binary patch
delta 15
WcmbO#KUJPhzMF$%!mf>M{rmtWSp>)c
delta 15
WcmbO#KUJPhzMF$%($tM?{rmtVtOTV1
diff --git a/rowers/urls.py b/rowers/urls.py
index ccb49dc7..73370658 100644
--- a/rowers/urls.py
+++ b/rowers/urls.py
@@ -845,8 +845,6 @@ urlpatterns = [
name='downgrade_checkouts'),
re_path(r'^purchasecheckouts/$', views.purchase_checkouts_view,
name='purchase_checkouts_view'),
- re_path(r'^planrequired/', views.planrequired_view,
- name='planrequired_view'),
re_path(r'^starttrial/$', views.start_trial_view, name='start_trial_view'),
re_path(r'^startplantrial/$', views.start_plantrial_view,
name='start_plantrial_view'),
@@ -856,8 +854,8 @@ urlpatterns = [
template_name='legal.html'), name='legal'),
re_path(r'^register/$', views.rower_register_view,
name='rower_register_view'),
- re_path(r'^coachregister/$', views.freecoach_register_view,
- name='freecoach_register_view'),
+ re_path(r'^coachregister/$', views.coach_register_view,
+ name='coach_register_view'),
path('activate/
{% endif %}
+ {% if rower and rower.rowerplan == 'basic' %}
+ {% endif %}
Available trial (no strings attached)
@@ -159,10 +160,13 @@
{% endif %}
+ {% if rower and rower.rowerplan == 'basic' %}
Available upgrades
+ {% endif %}
diff --git a/rowers/templates/rower_form.html b/rowers/templates/rower_form.html
index 1dd250ba..569c3559 100644
--- a/rowers/templates/rower_form.html
+++ b/rowers/templates/rower_form.html
@@ -62,7 +62,7 @@
{% endif %}
{% csrf_token %}
- {% if rower.rowerplan != 'coach' and rower.user == user %}
+ {% if rower.rowerplan != 'pro' and rower.user == user %}