From 0ba6d53f59680b986d2125ff418876ecdb325f1a Mon Sep 17 00:00:00 2001 From: cmekeirl Date: Thu, 23 May 2024 12:41:56 +0200 Subject: [PATCH] lint --- backend/project/endpoints/projects/projects.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/project/endpoints/projects/projects.py b/backend/project/endpoints/projects/projects.py index a68708a2..94813bbd 100644 --- a/backend/project/endpoints/projects/projects.py +++ b/backend/project/endpoints/projects/projects.py @@ -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 = [] @@ -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