Private
Public Access
1
0

further testing passing

This commit is contained in:
Sander Roosendaal
2020-01-15 21:36:27 +01:00
parent ec8a7cfdd1
commit 4ad334dce7
4 changed files with 8 additions and 4 deletions

View File

@@ -87,14 +87,15 @@ def can_start_trial(user):
if user.is_anonymous:
return False
return user.rower.protrialexpires > datetime.date(1970,1,1)
return user.rower.protrialexpires == datetime.date(1970,1,1)
@rules.predicate
def can_start_plantrial(user):
if user.is_anonymous:
return False
return user.rower.plantrialexpires > datetime.date(1970,1,1)
return user.rower.plantrialexpires == datetime.date(1970,1,1)
@rules.predicate
def is_coach(user):

View File

@@ -20,6 +20,8 @@ class SimpleViewTest(TestCase):
birthdate=faker.profile()['birthdate'],
gdproptin=True,surveydone=True,
gdproptindate=timezone.now(),
protrialexpires=datetime.date(1970,1,1),
plantrialexpires=datetime.date(1970,1,1),
rowerplan='basic')
self.c = Client()

View File

@@ -44,7 +44,8 @@ from rowers.rower_rules import (
can_view_target,can_change_target,can_delete_target,
can_view_plan,can_change_plan,can_delete_plan,
can_view_cycle,can_change_cycle,can_delete_cycle,
can_add_workout_member,can_plan_user,is_paid_coach
can_add_workout_member,can_plan_user,is_paid_coach,
can_start_trial, can_start_plantrial
)
from django.shortcuts import render

View File

@@ -438,7 +438,7 @@ def team_requestmembership_view(request,teamid,userid):
r = getrequestrower(request,userid=userid)
#if t.manager.rower.rowerplan in ['plan','pro'] and r.rowerplan == 'basic':
if not can_join_team(r.user,t)
if not can_join_team(r.user,t):
messages.error(request,
"You have to be on a paid plan (Pro or higher) to join this team. As a basic user you can only join teams managed by users on the Coach plan.")