passing tests
This commit is contained in:
@@ -103,15 +103,12 @@ def can_plan(user):
|
||||
|
||||
# checks if rower is coach of user
|
||||
@rules.predicate
|
||||
def is_coach_user(user,rower):
|
||||
try:
|
||||
r = user.rower
|
||||
except AttributeError:
|
||||
return False
|
||||
|
||||
if rower == r:
|
||||
def is_coach_user(usercoach,userrower):
|
||||
if usercoach == userrower:
|
||||
return True
|
||||
|
||||
r = userrower.rower
|
||||
|
||||
coaches = []
|
||||
|
||||
for group in r.coachinggroups.all():
|
||||
@@ -120,7 +117,7 @@ def is_coach_user(user,rower):
|
||||
coaches.append(coach)
|
||||
|
||||
for coach in coaches:
|
||||
if rower == coach:
|
||||
if usercoach.rower == coach:
|
||||
return True
|
||||
|
||||
return False
|
||||
@@ -199,7 +196,7 @@ def is_workout_user(user,workout):
|
||||
if workout.user == r:
|
||||
return True
|
||||
|
||||
return is_coach_user(workout.user.user,user.rower)
|
||||
return is_coach_user(user,workout.user.user)
|
||||
|
||||
# check if user can see workout
|
||||
@rules.predicate
|
||||
|
||||
Reference in New Issue
Block a user