From 50dfaaf9482971d508cc0b2b1cfc29e2890ceaba Mon Sep 17 00:00:00 2001 From: Cedric Mekeirle <143823820+JibrilExe@users.noreply.github.com> Date: Thu, 23 May 2024 16:36:23 +0200 Subject: [PATCH] Filter on conditions the students projects (#411) * projects visible for students * lint * filter on conditions * lint * fixed bad merge --- backend/project/endpoints/projects/projects.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/project/endpoints/projects/projects.py b/backend/project/endpoints/projects/projects.py index 94813bbd..03d46112 100644 --- a/backend/project/endpoints/projects/projects.py +++ b/backend/project/endpoints/projects/projects.py @@ -62,7 +62,10 @@ 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_(courses_student)).all() + projects_student = Project.query.filter(Project.course_id.in_(courses_student)) + projects_student = projects_student.filter(and_(*conditions)) \ + if conditions else projects_student + projects_student = projects_student.all() projects_student = [p for p in projects_student if p.visible_for_students] projects += projects_student