diff --git a/CHANGELOG.md b/CHANGELOG.md index 8535d204..dbebbcb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +### Date: 2025-March-05 +### Release: v2025030501 + +--- + +#### Quiz Attempt Issue Fixed +An issue was identified which affected the ability of users to view student submissions to quizzes in Moodle 4.1. This has now been fixed. + +--- + ### Date: 2024-December-19 ### Release: v2024121901 diff --git a/db/upgrade.php b/db/upgrade.php index 0c7e2f35..07adc55c 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -532,6 +532,7 @@ function xmldb_plagiarism_turnitin_upgrade($oldversion) { $dbman->add_index($table, $index); } } + upgrade_plugin_savepoint(true, 2021101800, 'plagiarism', 'turnitin'); } @@ -568,7 +569,6 @@ function xmldb_plagiarism_turnitin_upgrade($oldversion) { } upgrade_plugin_savepoint(true, 2022072501, 'plagiarism', 'turnitin'); } - return $result; } diff --git a/lib.php b/lib.php index 0a1cc109..454daad8 100755 --- a/lib.php +++ b/lib.php @@ -2601,7 +2601,14 @@ public function event_handler($eventdata) { // Queue every question submitted in a quiz attempt. if ($eventdata['eventtype'] == 'quiz_submitted') { - $attempt = mod_quiz\quiz_attempt::create($eventdata['objectid']); + + if (class_exists('\mod_quiz\quiz_attempt')) { + $quizattemptclass = '\mod_quiz\quiz_attempt'; + } else { + $quizattemptclass = 'quiz_attempt'; + } + $attempt = $quizattemptclass::create($eventdata['objectid']); + foreach ($attempt->get_slots() as $slot) { $qa = $attempt->get_question_attempt($slot); if ($qa->get_question()->get_type_name() != 'essay' && $qa->get_question()->get_type_name() != 'coderunner') { @@ -3203,7 +3210,13 @@ function plagiarism_turnitin_send_queued_submissions() { require_once($CFG->dirroot . '/mod/quiz/locallib.php'); try { - $attempt = mod_quiz\quiz_attempt::create($queueditem->itemid); + if (class_exists('\mod_quiz\quiz_attempt')) { + $quizattemptclass = '\mod_quiz\quiz_attempt'; + } else { + $quizattemptclass = 'quiz_attempt'; + } + $attempt = $quizattemptclass::create($queueditem->itemid); + } catch (Exception $e) { plagiarism_turnitin_activitylog(get_string('errorcode14', 'plagiarism_turnitin'), "PP_NO_ATTEMPT"); $errorcode = 14; diff --git a/version.php b/version.php index 0633c1f0..abdf4b6b 100644 --- a/version.php +++ b/version.php @@ -19,7 +19,7 @@ * @copyright 2012 iParadigms LLC */ -$plugin->version = 2024121901; +$plugin->version = 2025030501; $plugin->release = "4.1+"; $plugin->requires = 2018051700;