added: when user is removed from course he is also removed from projects inside course #126
This commit is contained in:
parent
4b08085d63
commit
ad3b232f5d
1 changed files with 7 additions and 0 deletions
|
@ -646,6 +646,13 @@ def removeUserFromCourse(token, userId, courseId):
|
|||
except Exception as e:
|
||||
return bad_request("user is not listed to this course")
|
||||
|
||||
#remove user from all projects in course
|
||||
projects = Project.all().filter("courseId =", course.key().id())
|
||||
for p in projects:
|
||||
if p.key().id() in userToRemove.projects_id_list:
|
||||
userToRemove.projects_id_list.remove(p.key().id())
|
||||
p.membersId.remove(userToRemove.key().id())
|
||||
db.put(p)
|
||||
|
||||
|
||||
db.put(userToRemove)
|
||||
|
|
Loading…
Reference in a new issue