From 0b5bbcf2a8c17fcb6ae13ebbf4290e1fdf5f183b Mon Sep 17 00:00:00 2001 From: Yuliang Weng <59968766+yld-weng@users.noreply.github.com> Date: Fri, 25 Aug 2023 17:13:20 +0100 Subject: [PATCH 1/2] fix(project): schedule should be rejected when status is rejected --- rse/models.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rse/models.py b/rse/models.py index e48c177..d39f9a9 100644 --- a/rse/models.py +++ b/rse/models.py @@ -675,6 +675,7 @@ class Project(PolymorphicModel): SCHEDULE_ACTIVE = "Active" SCHEDULE_COMPLETED = "Completed" SCHEDULE_SCHEDULED = "Scheduled" + SCHEDULE_REJECTED = "Rejected" SCHEDULE_CHOICES_TEXT_KEYS = ( ('Active', 'Active'), ('Completed', 'Completed'), @@ -778,6 +779,9 @@ def percent_allocated(self) -> float: @property def get_schedule_display(self) -> str: + if self.status == Project.REJECTED: + return Project.SCHEDULE_REJECTED + now = timezone.now().date() if now < self.start: return Project.SCHEDULE_SCHEDULED From 630a89bc9d109e330e647e46ada997f9f5231851 Mon Sep 17 00:00:00 2001 From: Yuliang Weng <59968766+yld-weng@users.noreply.github.com> Date: Fri, 25 Aug 2023 17:16:30 +0100 Subject: [PATCH 2/2] feat(project-form-filter): add rejected option --- rse/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rse/models.py b/rse/models.py index d39f9a9..d09aee2 100644 --- a/rse/models.py +++ b/rse/models.py @@ -680,6 +680,7 @@ class Project(PolymorphicModel): ('Active', 'Active'), ('Completed', 'Completed'), ('Scheduled', 'Scheduled'), + ('Rejected', 'Rejected'), ) @property @@ -779,6 +780,7 @@ def percent_allocated(self) -> float: @property def get_schedule_display(self) -> str: + """ Schedule should be rejected if the status is rejected. """ if self.status == Project.REJECTED: return Project.SCHEDULE_REJECTED