MDL-82584 mod_workshop: Correct DB select fields

We cannot use the `DISTINCT` CLOB fields on Oracle.
Instead of selecting all the fields, we just need
to select the needed fields only
This commit is contained in:
Huong Nguyen 2024-11-26 09:46:45 +07:00
parent f29f2ad5d3
commit ea4b1f8e7b
No known key found for this signature in database
GPG Key ID: 40D88AB693A3E72A

View File

@ -3385,9 +3385,10 @@ class workshop {
// This is from enrollib.php:get_enrolled_join(). It says it's better for caching to use round.
$now = round(time(), -2);
$userfieldsapi = \core_user\fields::for_name()->with_userpic();
$sqlarray = [];
$sqlarray['select'] = "SELECT DISTINCT u.*";
$sqlarray['select'] = "SELECT DISTINCT u.id" . $userfieldsapi->get_sql('u')->selects;
$sqlarray['from'] = "FROM {user} u";
$sqlarray['join'] = [];
$sqlarray['join'][] = "JOIN {user_enrolments} ue ON ue.userid = u.id";