Skip to content

Commit

Permalink
Merge pull request #115 from KQMATH/bug/#106
Browse files Browse the repository at this point in the history
resolved deprecation issue
  • Loading branch information
hgeorgsch authored Aug 7, 2023
2 parents 15f079a + 1494058 commit 4fcf383
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion classes/output/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,20 @@ public function require_core(jazzquiz_session $session) {
*/
public function require_quiz(jazzquiz_session $session) {
$this->require_core($session);
$this->page->requires->js('/question/qengine.js');

// question/qengine.js is deprecated for Moodle versions after 401.
// Checks moodle version in order to determine which question engine
// to use, making the jazzquiz independent of the Moodle version.
global $CFG;
include $CFG->dirroot.'/version.php';
$branch = $CFG->branch;

if ( (int) $branch <= 401 ) {
$this->page->requires->js('/question/qengine.js');
} else {
$this->page->requires->js_call_amd('core_question/question_engine', 'initialize');
}

if ($session->jazzquiz->is_instructor()) {
$count = count($session->jazzquiz->questions);
$params = [$count, false, []];
Expand Down

0 comments on commit 4fcf383

Please sign in to comment.