Merge branch 'master' of github.com:sagidayan/SE-Hub

This commit is contained in:
Sagi Dayan 2015-06-29 14:46:41 +03:00
commit 75d385a477
3 changed files with 10 additions and 7 deletions

View file

@ -126,8 +126,8 @@ def joinCampus(token, campusId):
if campus is None:
return bad_request("No such course")
if user.key().id() in campus.membersId:
return no_content("User is already member in Project")
if str(user.key().id()) in campus.membersId:
return bad_request("User is already member in Project")
campus.membersId.append(str(user.key().id()))
user.courses_id_list.append(str(campus.key().id()))

View file

@ -149,8 +149,8 @@ def joinCourse(token, courseId):
if course is None:
return bad_request("No such course")
if user.key().id() in course.membersId:
return no_content("User is already member in Project")
if str(user.key().id()) in course.membersId:
return bad_request("User is already member in Course")
course.membersId.append(str(user.key().id()))
user.courses_id_list.append(str(course.key().id()))

View file

@ -122,8 +122,8 @@ def joinProject(token, projectId):
if project is None:
return bad_request("No such Project")
if user.key().id() in project.membersId:
return no_content("User is already member in Project")
if str(user.key().id()) in project.membersId:
return bad_request("User is already member in Project")
project.membersId.append(str(user.key().id()))
@ -174,6 +174,7 @@ def getProjectsByCourse(token, courseId):
if get_user_by_token(token) is None:
return bad_request("Bad User Token")
arr = []
query = Project.all()
query.filter("courseId = ", int(courseId))
@ -233,7 +234,9 @@ def getProjectsByUser(token):
arr = []
for p in user.projects_id_list:
project = Project.get_by_id(int(p))
arr.append(dict(json.loads(project.to_JSON())))
projDict = dict(json.loads(project.to_JSON()))
projDict['info'] = get_github_data(project.gitRepository)
arr.append(projDict)
if len(arr) != 0:
return Response(response=json.dumps(arr),