Private
Public Access
1
0

passing tests again - now with coachinggroups

This commit is contained in:
Sander Roosendaal
2019-02-16 19:43:21 +01:00
parent ccdf24f671
commit 5f8fd9315a
8 changed files with 48 additions and 39 deletions

View File

@@ -185,14 +185,16 @@ def rower_teams_view(request,message='',successmessage=''):
invitedathletes = [rekwest.user for rekwest in mycoachoffers]
invitedcoaches = [rekwest.coach for rekwest in mycoachrequests]
coaches = rower_get_coaches(r)
coaches = teams.rower_get_coaches(r)
potentialcoaches = [t.manager for t in memberteams if t.manager not in coaches ]
potentialcoaches = [c for c in potentialcoaches if c.rower not in invitedcoaches]
coachees = teams.coach_getcoachees(r)
potentialathletes = Rower.objects.filter(
team__in=myteams).exclude(
user__in=invitedathletes).exclude(user=request.user)
user__in=invitedathletes).exclude(
user=request.user
).exclude(coachinggroups__in=[request.user.rower.mycoachgroup])
# clubsize = teams.count_invites(request.user)+teams.count_club_members(request.user)
@@ -336,16 +338,16 @@ def offer_coaching_view(request,userid):
coach = getrequestrower(request)
res,text = teams.create_coaching_invite(coach,u)
res,text = teams.create_coaching_offer(coach,u)
if res:
message.info(request,text)
messages.info(request,text)
else:
messages.error(request,text)
url = reverse('rower_teams_view')
return HttpResponseRedirecet(url)
return HttpResponseRedirect(url)
@login_required()
def reject_revoke_coach_request(request,id=0):
@@ -662,7 +664,7 @@ def rower_accept_coachoffer_view(request,code=None):
if code:
res, text = teams.process_coachoffer_code(request.user,code)
if res:
message.info(request,text)
messages.info(request,text)
else:
messages.error(request,text)