MDL-61986 mod_lesson: oracle order by clob fix
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Thu, 26 Apr 2018 16:30:26 +0000 (18:30 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Thu, 26 Apr 2018 16:30:40 +0000 (18:30 +0200)
mod/lesson/classes/privacy/provider.php

index cfcffd2..a2b0706 100644 (file)
@@ -546,7 +546,8 @@ class provider implements
             } else if ($data->page_qtype == LESSON_PAGE_MULTICHOICE && $data->page_qoption) {
                 // Multiple choice quesitons with multiple answers encode the answers.
                 list($insql, $inparams) = $DB->get_in_or_equal(explode(',', $answer), SQL_PARAMS_NAMED);
-                $records = $DB->get_records_select('lesson_answers', "id $insql", $inparams, 'id, answer, answerformat');
+                $orderby = 'id, ' . $DB->sql_order_by_text('answer') . ', answerformat';
+                $records = $DB->get_records_select('lesson_answers', "id $insql", $inparams, $orderby);
                 $answer = array_values(array_map(function($record) use ($options) {
                     return format_text($record->answer, $record->answerformat, $options);
                 }, empty($records) ? [] : $records));