aboutsummaryrefslogtreecommitdiff
path: root/lib/models/Course.class.php
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2026-02-10 10:18:09 +0100
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2026-02-10 10:22:30 +0100
commit3c0331c8f3b5cf96b1078aa376888972b784ed2c (patch)
treebc43772378d80915367a70fb86e490a116363425 /lib/models/Course.class.php
parentc30fd7c83a3de7099fbaf3de45885644870154e5 (diff)
don't send messages for waitlist changes for course that have ended, fixes #6224
Closes #6224 Merge request studip/studip!4710
Diffstat (limited to 'lib/models/Course.class.php')
-rw-r--r--lib/models/Course.class.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/models/Course.class.php b/lib/models/Course.class.php
index 97b246b..76a7be7 100644
--- a/lib/models/Course.class.php
+++ b/lib/models/Course.class.php
@@ -436,7 +436,7 @@ class Course extends SimpleORMap implements Range, PrivacyObject, StudipItem, Fe
* @returns Semester|null Either the last semester of the course
* or null, if no semester could be found.
*/
- public function getEndSemester()
+ public function getEndSemester(): ?Semester
{
if (count($this->semesters) > 0) {
return $this->semesters->last();
@@ -486,6 +486,16 @@ class Course extends SimpleORMap implements Range, PrivacyObject, StudipItem, Fe
}
}
+ /**
+ * Returns whether the course has ended, meaning it is not open ended and
+ * all semesters the course takes place in are in the past.
+ */
+ public function hasEnded(): bool
+ {
+ return !$this->isOpenEnded()
+ && $this->getEndSemester()->isPast();
+ }
+
public function getTeachers()
{
return $this->members->filter(function ($m) {