Skip to content

Commit

Permalink
Filter on conditions the students projects (#411)
Browse files Browse the repository at this point in the history
* projects visible for students

* lint

* filter on conditions

* lint

* fixed bad merge
  • Loading branch information
JibrilExe authored May 23, 2024
1 parent e7129cd commit 50dfaaf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion backend/project/endpoints/projects/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 50dfaaf

Please sign in to comment.