Skip to content

Commit

Permalink
quiz-data - Update for deprecation, PHP
Browse files Browse the repository at this point in the history
  • Loading branch information
EJMFarrow committed Nov 20, 2024
1 parent 52be5ac commit 881585b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion classes/external/import_quiz_data.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public static function execute(array $quiz, array $sections, array $questions, a
$module = get_module_from_cmid($moduleinfo->coursemodule)[0];
// Sort questions by slot.
usort($params['questions'], function($a, $b) {
return (int) $a['slot'] > (int) $b['slot'];
return ((int) $a['slot'] > (int) $b['slot']) ? true : false;
});
foreach ($params['questions'] as $question) {
$qdata = get_minimal_question_data($question['questionbankentryid']);
Expand Down
6 changes: 5 additions & 1 deletion tests/external/export_quiz_data_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ public function setUp(): void {
$this->quizmoduleid = $this->quiz->cmid;
\quiz_add_quiz_question($this->q->id, $this->quiz);
\quiz_add_quiz_question($q2->id, $this->quiz);
$quizobj = \quiz::create($this->quiz->id);
if (class_exists('\mod_quiz\quiz_settings')) {
$quizobj = \mod_quiz\quiz_settings::create($this->quiz->id);
} else {
$quizobj = \quiz::create($this->quiz->id);
}
\mod_quiz\structure::create_for_quiz($quizobj);

}
Expand Down

0 comments on commit 881585b

Please sign in to comment.