Skip to content

Commit

Permalink
move filter logic into user_theses object
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrzejMorawski00 committed Dec 3, 2024
1 parent 7aa8c50 commit 8bdb985
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions zapisy/apps/theses/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ class ThesesQuerySet(models.QuerySet):
def visible(self, user):
if user.is_staff or is_theses_board_member(user):
return self
student_theses = self.filter(students__user=user)

user_theses = self.filter(Q(students__user=user) | Q(advisor__user=user) | Q(supporting_advisor__user=user))
return self.filter(
(~Q(status=ThesisStatus.BEING_EVALUATED) & ~Q(status=ThesisStatus.RETURNED_FOR_CORRECTIONS)) |
Q(advisor__user=user) |
Q(supporting_advisor__user=user) |
Q(id__in=student_theses))
(~Q(status=ThesisStatus.BEING_EVALUATED) &
~Q(status=ThesisStatus.RETURNED_FOR_CORRECTIONS)) |
Q(id__in=user_theses))


class Thesis(models.Model):
Expand Down

0 comments on commit 8bdb985

Please sign in to comment.