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