Skip to content
Snippets Groups Projects
Commit 02df4969 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

only select distinct courses in Course::findByUser(), fixes #2086

Closes #2086

Merge request studip/studip!1350
parent e680fded
No related branches found
No related tags found
No related merge requests found
......@@ -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]
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment