From 4cc03b43693d7cf7800cffbd2b2f6720513bae11 Mon Sep 17 00:00:00 2001 From: Edmund Farrow Date: Wed, 20 Nov 2024 15:08:28 +0000 Subject: [PATCH] quiz-data - CI fixes --- .github/workflows/moodle-ci.yml | 11 ++++++++++- classes/external/import_quiz_data.php | 8 +++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/moodle-ci.yml b/.github/workflows/moodle-ci.yml index afbce1b..52b0391 100644 --- a/.github/workflows/moodle-ci.yml +++ b/.github/workflows/moodle-ci.yml @@ -32,7 +32,16 @@ jobs: matrix: # I don't know why, but mariadb is much slower, so mostly use pgsql. include: - php: '8.2' - moodle-branch: 'master' + moodle-branch: 'main' + database: 'pgsql' + - php: '8.2' + moodle-branch: 'MOODLE_405_STABLE' + database: 'pgsql' + - php: '8.2' + moodle-branch: 'MOODLE_404_STABLE' + database: 'pgsql' + - php: '8.1' + moodle-branch: 'MOODLE_403_STABLE' database: 'pgsql' - php: '8.1' moodle-branch: 'MOODLE_402_STABLE' diff --git a/classes/external/import_quiz_data.php b/classes/external/import_quiz_data.php index b228771..e0df504 100644 --- a/classes/external/import_quiz_data.php +++ b/classes/external/import_quiz_data.php @@ -159,7 +159,13 @@ 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']) ? true : false; + if ((int) $a['slot'] > (int) $b['slot']) { + return 1; + } else if ((int) $a['slot'] < (int) $b['slot']) { + return -1; + } else { + return 0; + } }); foreach ($params['questions'] as $question) { $qdata = get_minimal_question_data($question['questionbankentryid']);