aboutsummaryrefslogtreecommitdiff
path: root/lib/models/Course.class.php
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2023-01-27 07:21:41 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2023-01-27 07:21:41 +0000
commit02df49692e0fbc92e1f96078f0d0962ac6df0a18 (patch)
tree0298343a3808dfb850df114be436a92d3a7e75e7 /lib/models/Course.class.php
parente680fded17c9be41c07b070235822a06e49aecfc (diff)
only select distinct courses in Course::findByUser(), fixes #2086
Closes #2086 Merge request studip/studip!1350
Diffstat (limited to 'lib/models/Course.class.php')
-rw-r--r--lib/models/Course.class.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/models/Course.class.php b/lib/models/Course.class.php
index 4500daa..d9325b0 100644
--- a/lib/models/Course.class.php
+++ b/lib/models/Course.class.php
@@ -935,7 +935,7 @@ class Course extends SimpleORMap implements Range, PrivacyObject, StudipItem, Fe
* @param bool $with_deputies Whether to include courses where the user is
* a deputy (true) or not (false). Defaults to true.
*
- * @returns Course[] A list of courses.
+ * @return Course[] A list of courses.
*/
public static function findByUser($user_id, $perms = [], $with_deputies = true)
{
@@ -960,6 +960,7 @@ class Course extends SimpleORMap implements Range, PrivacyObject, StudipItem, Fe
return Course::findBySQL(
"LEFT JOIN semester_courses ON (semester_courses.course_id = seminare.Seminar_id)
WHERE Seminar_id IN (?)
+ GROUP BY seminare.Seminar_id
ORDER BY IF(semester_courses.semester_id IS NULL, 1, 0) DESC, start_time DESC, Name ASC",
[$seminar_ids]
);