Merge branch 'release/v18.6.8'
This commit is contained in:
@@ -25,7 +25,7 @@ class RowerInline(admin.StackedInline):
|
||||
('Billing Details',
|
||||
{'fields': ('street_address', 'city', 'postal_code', 'country', 'paymentprocessor', 'customer_id')}),
|
||||
('Rower Plan',
|
||||
{'fields': ('paidplan', 'rowerplan', 'paymenttype', 'planexpires', 'teamplanexpires', 'protrialexpires', 'plantrialexpires', 'eurocredits', 'clubsize', 'offercoaching')}),
|
||||
{'fields': ('paidplan', 'rowerplan', 'paymenttype', 'planexpires', 'teamplanexpires', 'protrialexpires', 'plantrialexpires', 'coachtrialexpires', 'eurocredits', 'clubsize', 'offercoaching')}),
|
||||
('Rower Settings',
|
||||
{'fields':
|
||||
('surveydone', 'surveydonedate', 'gdproptin', 'gdproptindate', 'weightcategory', 'sex', 'adaptiveclass', 'birthdate', 'getemailnotifications',
|
||||
|
||||
@@ -99,6 +99,8 @@ def user_is_coachee(user):
|
||||
for coach in coaches:
|
||||
if coach.rowerplan == 'coach':
|
||||
return True
|
||||
if coach.coachtrialexpires >= timezone.now().date():
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
@@ -153,6 +155,8 @@ def is_not_freecoach(user):
|
||||
|
||||
|
||||
def is_paid_coach(user):
|
||||
if user.rower.coachtrialexpires >= timezone.now().date():
|
||||
return True
|
||||
return user.rower.rowerplan == 'coach'
|
||||
|
||||
|
||||
@@ -750,6 +754,8 @@ def is_team_member(user, team): # pragma: no cover
|
||||
@rules.predicate
|
||||
def can_view_team(user, team):
|
||||
# user based - below untested
|
||||
if team.manager.rower.coachtrialexpires >= timezone.now().date():
|
||||
return True
|
||||
if user.rower.rowerplan == 'basic' and team.manager.rower.rowerplan != 'coach': # pragma: no cover
|
||||
return is_plantrial(user) or is_protrial(user) or is_coachtrial(user)
|
||||
# team is public
|
||||
|
||||
@@ -646,6 +646,7 @@ def process_invite_code(user, code): # pragma: no cover
|
||||
|
||||
result, comment = add_member(t.id, r)
|
||||
|
||||
|
||||
if not result:
|
||||
return (result, "The member couldn't be added")
|
||||
|
||||
|
||||
@@ -383,8 +383,9 @@ def rower_exportsettings_view(request, userid=0):
|
||||
cd = form.cleaned_data
|
||||
if r.rowerplan == 'basic': # pragma: no cover
|
||||
messages.error(
|
||||
request, 'These settings can only be set if you are a user" \
|
||||
" on one of the <a href="/rowers/paidplans">paid plans</a>.')
|
||||
request, 'This setting will only be effective if you are a user \
|
||||
on one of the <a href="/rowers/paidplans">paid plans</a> \
|
||||
or part of a coaching group.')
|
||||
|
||||
for attr, value in cd.items():
|
||||
doset = True
|
||||
|
||||
Reference in New Issue
Block a user