Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
JibrilExe committed May 23, 2024
1 parent 69c5fb0 commit 0ba6d53
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/project/endpoints/projects/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ def get(self, uid=None):
}
try:
# Get all the courses a user is part of
coursesStudent = CourseStudent.query.filter_by(uid=uid).\
courses_student = CourseStudent.query.filter_by(uid=uid).\
with_entities(CourseStudent.course_id).all()
courses = CourseAdmin.query.filter_by(uid=uid).\
with_entities(CourseAdmin.course_id).all()
courses += Course.query.filter_by(teacher=uid).with_entities(Course.course_id).all()
courses = [c[0] for c in courses] # Remove the tuple wrapping the course_id
coursesStudent = [c[0] for c in coursesStudent]
courses_student = [c[0] for c in courses_student]
# Filter the projects based on the query parameters
filters = dict(request.args)
conditions = []
Expand All @@ -62,7 +62,7 @@ def get(self, uid=None):
projects = projects.filter(and_(*conditions)) if conditions else projects
projects = projects.all()
projects = [p for p in projects if get_course_of_project(p.project_id) in courses]
projects_student = Project.query.filter(Project.course_id.in_(coursesStudent)).all()
projects_student = Project.query.filter(Project.course_id.in_(courses_student)).all()
projects_student = [p for p in projects_student if p.visible_for_students]
projects += projects_student

Expand Down

0 comments on commit 0ba6d53

Please sign in to comment.