From 12835ab93625c50ad803084975434bc489d37edc Mon Sep 17 00:00:00 2001 From: Bogdan Rychlikowski <42639655+Brychlikov@users.noreply.github.com> Date: Sun, 29 Sep 2024 14:07:05 +0200 Subject: [PATCH] =?UTF-8?q?Z=20filtrem=20"niezarezerwowanych=20prac"=20nie?= =?UTF-8?q?=20wy=C5=9Bwietlamy=20tych=20obronionych=20(#1469)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Efekt na pewno nie jest jeszcze zgodny z intencją, ale do tego nie obejdzie się bez pewnego zadbania o jakość danych (ponieważ GIGO) i/lub samego ich modelu. --- zapisy/apps/theses/models.py | 5 +++++ zapisy/apps/theses/views.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/zapisy/apps/theses/models.py b/zapisy/apps/theses/models.py index cb54211e2f..e9167cdd8a 100644 --- a/zapisy/apps/theses/models.py +++ b/zapisy/apps/theses/models.py @@ -140,6 +140,11 @@ def has_no_students_assigned(self): def is_reserved(self): return self.reserved_until and date.today() <= self.reserved_until + @property + def is_available(self): + is_defended = self.status == ThesisStatus.DEFENDED + return not (self.is_reserved or is_defended) + @property def has_been_accepted(self): return self.status != ThesisStatus.RETURNED_FOR_CORRECTIONS and self.status != ThesisStatus.BEING_EVALUATED diff --git a/zapisy/apps/theses/views.py b/zapisy/apps/theses/views.py index 5955bf1850..fb198b4933 100644 --- a/zapisy/apps/theses/views.py +++ b/zapisy/apps/theses/views.py @@ -24,7 +24,7 @@ def list_all(request): theses_list = [] for p in visible_theses: title = p.title - is_available = not p.is_reserved + is_available = p.is_available kind = p.get_kind_display() status = p.get_status_display() is_mine = p.is_mine(request.user) or p.is_student_assigned(