aboutsummaryrefslogtreecommitdiff
path: root/lib/models/Course.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:18:09 +0100
commite08d2d6e3f0c646d93ae39203962dfc7da512294 (patch)
tree78737db045260453ca4a4b664909586b54d8623e /lib/models/Course.php
parent30850f81e7b0e3f7f6a2a3c09ddb6064ee4cbac1 (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.php')
-rw-r--r--lib/models/Course.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/models/Course.php b/lib/models/Course.php
index d35c6c3..dbe8445 100644
--- a/lib/models/Course.php
+++ b/lib/models/Course.php
@@ -584,7 +584,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
{
//this is called by __get() and therefore using magic properties is not always safe
if ($this->relations['semesters'] === null) {
@@ -636,6 +636,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) {