From bd9ed1d5e272bed9db9879920f3c1e2dfeca506d Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Wed, 30 Jun 2021 13:30:50 +1200 Subject: [PATCH 01/10] Fix #591 - Cache activity settings correctly when disabled. --- lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib.php b/lib.php index 1f1f4b21..fe850f9f 100755 --- a/lib.php +++ b/lib.php @@ -686,8 +686,8 @@ public function get_links($linkarray) { } // Retrieve the plugin settings for this module. - static $plagiarismsettings; - if (empty($plagiarismsettings)) { + static $plagiarismsettings = null; + if (is_null($plagiarismsettings)) { $plagiarismsettings = $this->get_settings($linkarray["cmid"]); } From 07d72b067bf74fc3c30db96bf7286fa28484991a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1igo=20Zendegi?= Date: Fri, 2 Jul 2021 12:35:37 +0200 Subject: [PATCH 02/10] Add filter support to submitter&instructor message We've detected that the messages send by Turnitin to submitters and instructors don't apply the Moodle filters (we use filter_multilang2, but it may happen also with order filters), this change fixes that. --- classes/digitalreceipt/pp_receipt_message.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/digitalreceipt/pp_receipt_message.php b/classes/digitalreceipt/pp_receipt_message.php index 5bb048f9..9792abda 100644 --- a/classes/digitalreceipt/pp_receipt_message.php +++ b/classes/digitalreceipt/pp_receipt_message.php @@ -73,7 +73,7 @@ public function build_message($input) { $message->submission_date = $input['submission_date']; $message->submission_id = $input['submission_id']; - return get_string('pp_digital_receipt_message', 'plagiarism_turnitin', $message); + return format_string(get_string('pp_digital_receipt_message', 'plagiarism_turnitin', $message)); } /** @@ -96,7 +96,7 @@ public function build_instructor_message($input) { $message->submission_date = $input['submission_date']; $message->submission_id = $input['submission_id']; - return get_string('receipt_instructor_copy', 'plagiarism_turnitin', $message); + return format_string(get_string('receipt_instructor_copy', 'plagiarism_turnitin', $message)); } /** From 974e5f6e036a0cc6d289d872764e949542716235 Mon Sep 17 00:00:00 2001 From: Jonathon Fowler Date: Fri, 4 Mar 2022 12:09:32 +1000 Subject: [PATCH 03/10] Show the 'accept EULA' prompt on new replies made in-page to a forum --- amd/build/eula.min.js | 2 +- amd/build/eula.min.js.map | 2 +- amd/src/eula.js | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/amd/build/eula.min.js b/amd/build/eula.min.js index 445c6155..55e5aca3 100644 --- a/amd/build/eula.min.js +++ b/amd/build/eula.min.js @@ -1,2 +1,2 @@ -define ("plagiarism_turnitin/eula",["jquery","core/templates","core/modal_factory","core/modal_events","plagiarism_turnitin/modal_eula_launch"],function(a,b,c,d,e){return{eulaLaunch:function eulaLaunch(){var b=a(".pp_turnitin_eula");b.show();a(document).on("click",".pp_turnitin_eula_link",function(){c.create({type:e.TYPE,templateContext:{cmid:a("input[name=\"coursemodule\"]").val(),wwwroot:M.cfg.wwwroot},large:!0}).then(function(a){a.show();a.getRoot().find(".modal").addClass("tii_pp_modal_eula");a.getRoot().find(".modal-content").addClass("tii_pp_modal_eula_content")})});if(0\n * @module plagiarism_turnitin/eulaLaunch\n */\n\ndefine(['jquery',\n 'core/templates',\n 'core/modal_factory',\n 'core/modal_events',\n 'plagiarism_turnitin/modal_eula_launch'\n ],\n function($, Templates, ModalFactory, ModalEvents, ModalEulaLaunch) {\n return {\n eulaLaunch: function() {\n var turnitinEulaClass = $(\".pp_turnitin_eula\");\n turnitinEulaClass.show();\n\n $(document).on('click', '.pp_turnitin_eula_link', function() {\n ModalFactory.create({\n type: ModalEulaLaunch.TYPE,\n templateContext: {\n cmid: $('input[name=\"coursemodule\"]').val(),\n wwwroot: M.cfg.wwwroot\n },\n large: true\n })\n .then(function (modal) {\n modal.show();\n modal.getRoot().find('.modal').addClass('tii_pp_modal_eula');\n modal.getRoot().find('.modal-content').addClass('tii_pp_modal_eula_content');\n });\n });\n\n // Hide the submission form if the user has never accepted or declined the Turnitin EULA.\n if ($(\".pp_turnitin_eula_ignored\").length > 0) {\n if ($('.editsubmissionform').length > 0) {\n $('.editsubmissionform').hide();\n }\n if (turnitinEulaClass.siblings('.mform').length > 0) {\n turnitinEulaClass.siblings('.mform').hide();\n }\n }\n }\n };\n });"],"file":"eula.min.js"} \ No newline at end of file +{"version":3,"sources":["../src/eula.js"],"names":["define","$","Templates","ModalFactory","ModalEvents","ModalEulaLaunch","eulaLaunch","turnitinEulaClass","show","document","on","event","newid","create","type","TYPE","templateContext","cmid","val","wwwroot","M","cfg","large","then","modal","getRoot","find","addClass","length","hide","siblings"],"mappings":"AASAA,OAAM,4BAAC,CAAC,QAAD,CACC,gBADD,CAEC,oBAFD,CAGC,mBAHD,CAIC,uCAJD,CAAD,CAMF,SAASC,CAAT,CAAYC,CAAZ,CAAuBC,CAAvB,CAAqCC,CAArC,CAAkDC,CAAlD,CAAmE,CAC/D,MAAO,CACHC,UAAU,CAAE,qBAAW,CACnB,GAAIC,CAAAA,CAAiB,CAAGN,CAAC,CAAC,mBAAD,CAAzB,CACAM,CAAiB,CAACC,IAAlB,GAGAP,CAAC,CAACQ,QAAD,CAAD,CAAYC,EAAZ,CAAe,wBAAf,CAAyC,uBAAzC,CAAkE,SAAUC,CAAV,CAAiBC,CAAjB,CAAwB,CACtF,GAAIL,CAAAA,CAAiB,CAAGN,CAAC,CAAC,iBAAmBW,CAAnB,CAA2B,oBAA5B,CAAzB,CACAL,CAAiB,CAACC,IAAlB,EACH,CAHD,EAKAP,CAAC,CAACQ,QAAD,CAAD,CAAYC,EAAZ,CAAe,OAAf,CAAwB,wBAAxB,CAAkD,UAAW,CACzDP,CAAY,CAACU,MAAb,CAAoB,CAChBC,IAAI,CAAET,CAAe,CAACU,IADN,CAEhBC,eAAe,CAAE,CACbC,IAAI,CAAEhB,CAAC,CAAC,8BAAD,CAAD,CAAgCiB,GAAhC,EADO,CAEbC,OAAO,CAAEC,CAAC,CAACC,GAAF,CAAMF,OAFF,CAFD,CAMhBG,KAAK,GANW,CAApB,EAQKC,IARL,CAQU,SAAUC,CAAV,CAAiB,CACnBA,CAAK,CAAChB,IAAN,GACAgB,CAAK,CAACC,OAAN,GAAgBC,IAAhB,CAAqB,QAArB,EAA+BC,QAA/B,CAAwC,mBAAxC,EACAH,CAAK,CAACC,OAAN,GAAgBC,IAAhB,CAAqB,gBAArB,EAAuCC,QAAvC,CAAgD,2BAAhD,CACH,CAZL,CAaH,CAdD,EAiBA,GAA4C,CAAxC,CAAA1B,CAAC,CAAC,2BAAD,CAAD,CAA+B2B,MAAnC,CAA+C,CAC3C,GAAsC,CAAlC,CAAA3B,CAAC,CAAC,qBAAD,CAAD,CAAyB2B,MAA7B,CAAyC,CACrC3B,CAAC,CAAC,qBAAD,CAAD,CAAyB4B,IAAzB,EACH,CACD,GAAkD,CAA9C,CAAAtB,CAAiB,CAACuB,QAAlB,CAA2B,QAA3B,EAAqCF,MAAzC,CAAqD,CACjDrB,CAAiB,CAACuB,QAAlB,CAA2B,QAA3B,EAAqCD,IAArC,EACH,CACJ,CACJ,CApCE,CAsCV,CA7CC,CAAN","sourcesContent":["/**\n * Javascript controller for launching the EULA modal.\n *\n * @package turnitin\n * @copyright Turnitin\n * @author 2019 David Winn \n * @module plagiarism_turnitin/eulaLaunch\n */\n\ndefine(['jquery',\n 'core/templates',\n 'core/modal_factory',\n 'core/modal_events',\n 'plagiarism_turnitin/modal_eula_launch'\n ],\n function($, Templates, ModalFactory, ModalEvents, ModalEulaLaunch) {\n return {\n eulaLaunch: function() {\n var turnitinEulaClass = $(\".pp_turnitin_eula\");\n turnitinEulaClass.show();\n\n // Show the 'accept EULA' prompt for new in-page forum replies.\n $(document).on('mod_forum-post-created', '.forum-post-container', function (event, newid) {\n var turnitinEulaClass = $(\"#post-content-\" + newid + \" .pp_turnitin_eula\");\n turnitinEulaClass.show();\n });\n\n $(document).on('click', '.pp_turnitin_eula_link', function() {\n ModalFactory.create({\n type: ModalEulaLaunch.TYPE,\n templateContext: {\n cmid: $('input[name=\"coursemodule\"]').val(),\n wwwroot: M.cfg.wwwroot\n },\n large: true\n })\n .then(function (modal) {\n modal.show();\n modal.getRoot().find('.modal').addClass('tii_pp_modal_eula');\n modal.getRoot().find('.modal-content').addClass('tii_pp_modal_eula_content');\n });\n });\n\n // Hide the submission form if the user has never accepted or declined the Turnitin EULA.\n if ($(\".pp_turnitin_eula_ignored\").length > 0) {\n if ($('.editsubmissionform').length > 0) {\n $('.editsubmissionform').hide();\n }\n if (turnitinEulaClass.siblings('.mform').length > 0) {\n turnitinEulaClass.siblings('.mform').hide();\n }\n }\n }\n };\n });"],"file":"eula.min.js"} \ No newline at end of file diff --git a/amd/src/eula.js b/amd/src/eula.js index 9312afa6..f82fdcfe 100644 --- a/amd/src/eula.js +++ b/amd/src/eula.js @@ -19,6 +19,12 @@ define(['jquery', var turnitinEulaClass = $(".pp_turnitin_eula"); turnitinEulaClass.show(); + // Show the 'accept EULA' prompt for new in-page forum replies. + $(document).on('mod_forum-post-created', '.forum-post-container', function (event, newid) { + var turnitinEulaClass = $("#post-content-" + newid + " .pp_turnitin_eula"); + turnitinEulaClass.show(); + }); + $(document).on('click', '.pp_turnitin_eula_link', function() { ModalFactory.create({ type: ModalEulaLaunch.TYPE, From 3be91964eb035efcabe9c8a1a957bfe2d5e8c63c Mon Sep 17 00:00:00 2001 From: Jonathon Fowler Date: Wed, 15 Jun 2022 16:38:37 +1000 Subject: [PATCH 04/10] fix quiz attempt grades being incorrectly calculated --- classes/modules/turnitin_quiz.class.php | 2 +- tests/modules/turnitin_quiz_test.php | 93 +++++++++++++++++++++++++ 2 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 tests/modules/turnitin_quiz_test.php diff --git a/classes/modules/turnitin_quiz.class.php b/classes/modules/turnitin_quiz.class.php index 5937453e..42703699 100644 --- a/classes/modules/turnitin_quiz.class.php +++ b/classes/modules/turnitin_quiz.class.php @@ -76,7 +76,7 @@ public function update_mark($attemptid, $identifier, $userid, $grade, $quizgrade $transaction = $DB->start_delegated_transaction(); $attempt = quiz_attempt::create($attemptid); - $quba = question_engine::load_questions_usage_by_activity($attemptid); + $quba = question_engine::load_questions_usage_by_activity($attempt->get_uniqueid()); // Loop through each question slot. foreach ($attempt->get_slots() as $slot) { diff --git a/tests/modules/turnitin_quiz_test.php b/tests/modules/turnitin_quiz_test.php new file mode 100644 index 00000000..51e4f478 --- /dev/null +++ b/tests/modules/turnitin_quiz_test.php @@ -0,0 +1,93 @@ +. + +/** + * Unit tests for (some of) plagiarism/turnitin/classes/modules/turnitin_quiz.class.php. + * + * @package plagiarism_turnitin + * @copyright 2017 Turnitin + * @copyright 2022 The University of Southern Queensland + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +global $CFG; +require_once($CFG->dirroot . '/plagiarism/turnitin/lib.php'); + +/** + * Tests for Turnitin quiz class. + * + * @package plagiarism_turnitin + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class plagiarism_turnitin_quiz_testcase extends advanced_testcase { + /** + * Proves that essay response marks are correctly updated. + * + * @copyright 2014 Tim Hunt + */ + public function test_update_mark() { + $this->resetAfterTest(); + + // Create a user, course, and quiz activity with an essay question. + // Lifted largely from mod_quiz_attempt_testcase. + $user = $this->getDataGenerator()->create_user(); + $course = $this->getDataGenerator()->create_course(); + $generator = $this->getDataGenerator()->get_plugin_generator('mod_quiz'); + $quiz = $generator->create_instance([ + 'course' => $course->id, + 'grade' => 100, + 'sumgrades' => 1, + 'layout' => '1,0', + ]); + + $quizobj = quiz::create($quiz->id, $user->id); + $quba = question_engine::make_questions_usage_by_activity('mod_quiz', $quizobj->get_context()); + $quba->set_preferred_behaviour($quizobj->get_quiz()->preferredbehaviour); + + $questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question'); + $cat = $questiongenerator->create_question_category(); + $question = $questiongenerator->create_question('essay', null, ['category' => $cat->id]); + quiz_add_quiz_question($question->id, $quiz, 1, 1); // 1 mark for the question. + + // Start and finish an attempt at the quiz. + $timenow = time(); + $attempt = quiz_create_attempt($quizobj, 1, false, $timenow, false, $user->id); + quiz_start_new_attempt($quizobj, $quba, $attempt, 1, $timenow); + quiz_attempt_save_started($quizobj, $quba, $attempt); + $attemptobj = quiz_attempt::create($attempt->id); + $attemptobj->process_finish($timenow, false); + + // Expect no marks or grade for the attempt yet. + $attemptobj = quiz_attempt::create($attempt->id); + $this->assertEquals(0.0, $attemptobj->get_sum_marks()); + $grade = quiz_get_best_grade($quiz, $user->id); + $this->assertEquals(0.0, $grade); + + // Now update the grade of the essay question through the Turnitin quiz class. + $tiiquiz = new turnitin_quiz; + $answer = $attemptobj->get_question_attempt(1)->get_response_summary(); + $identifier = sha1($answer); + $tiiquiz->update_mark($attempt->id, $identifier, $user->id, 75, $quiz->grade); + + // Reload the attempt and check the total marks and grade are as we expect it. + $attemptobj = quiz_attempt::create($attempt->id); + $this->assertEquals(0.75, $attemptobj->get_sum_marks()); + $grade = quiz_get_best_grade($quiz, $user->id); + $this->assertEquals(75.0, $grade); + } +} From 822fde1372d606123dbdc89d5d60cc33987f2521 Mon Sep 17 00:00:00 2001 From: Adam Olley Date: Mon, 20 Jun 2022 11:32:27 +0930 Subject: [PATCH 05/10] Only load cmid when its not already present Without this, get_links calls load up the cmid of quizzes every time its called (which can be hundreds of times) - ignoring when its already been given the cmid. --- lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib.php b/lib.php index c84a9b3f..25fe46c5 100755 --- a/lib.php +++ b/lib.php @@ -657,7 +657,7 @@ public function get_links($linkarray) { // If this is a quiz, retrieve the cmid $component = (!empty($linkarray['component'])) ? $linkarray['component'] : ""; - if ($component == "qtype_essay" && !empty($linkarray['area'])) { + if ($component == "qtype_essay" && !empty($linkarray['area']) && empty($linkarray['cmid'])) { $questions = question_engine::load_questions_usage_by_activity($linkarray['area']); // Try to get cm using the questions owning context. From a47d91ca5fcbf371bd16272dea9f3cfaf7210722 Mon Sep 17 00:00:00 2001 From: Mikhail Golenkov Date: Mon, 24 May 2021 13:18:04 +1000 Subject: [PATCH 06/10] Set userid and courseid columns to be NOT NULL --- db/upgrade.php | 36 ++++++++++++++++++++++++++++++++++++ version.php | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/db/upgrade.php b/db/upgrade.php index 3c656f5f..a3bea428 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -500,6 +500,42 @@ function xmldb_plagiarism_turnitin_upgrade($oldversion) { upgrade_plugin_savepoint(true, 2021081301, 'plagiarism', 'turnitin'); } + if ($oldversion < 2022071800) { + // Set userid to be NOT NULL. + $table = new xmldb_table('plagiarism_turnitin_users'); + $index = new xmldb_index('userid', XMLDB_INDEX_UNIQUE, array('userid')); + $field = new xmldb_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'id'); + if ($dbman->field_exists($table, $field)) { + // Double-check that there is no records with a NULL value. + if ($DB->count_records_select('plagiarism_turnitin_users', 'userid IS NULL') == 0) { + // Drop and then recreate unique index, otherwise Moodle will throw dependency exception. + if ($dbman->index_exists($table, $index)) { + $dbman->drop_index($table, $index); + } + $dbman->change_field_notnull($table, $field); + $dbman->add_index($table, $index); + } + } + + // Set courseid to be NOT NULL. + $table = new xmldb_table('plagiarism_turnitin_courses'); + $index = new xmldb_index('courseid', XMLDB_INDEX_UNIQUE, array('courseid')); + $field = new xmldb_field('courseid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'id'); + if ($dbman->field_exists($table, $field)) { + // Double-check that there is no records with a NULL value. + if ($DB->count_records_select('plagiarism_turnitin_courses', 'courseid IS NULL') == 0) { + // Drop and then recreate unique index, otherwise Moodle will throw dependency exception. + if ($dbman->index_exists($table, $index)) { + $dbman->drop_index($table, $index); + } + $dbman->change_field_notnull($table, $field); + $dbman->add_index($table, $index); + } + } + + upgrade_plugin_savepoint(true, 2022071800, 'plagiarism', 'turnitin'); + } + return $result; } diff --git a/version.php b/version.php index 991c04a6..34a934f3 100644 --- a/version.php +++ b/version.php @@ -19,7 +19,7 @@ * @copyright 2012 iParadigms LLC */ -$plugin->version = 2022032301; +$plugin->version = 2022071800; $plugin->release = "3.5+"; $plugin->requires = 2018051700; $plugin->component = 'plagiarism_turnitin'; From 8c5ffb91c155c8a43968afdb908d09bcb32d14f3 Mon Sep 17 00:00:00 2001 From: Tomo Tsuyuki Date: Fri, 22 Jul 2022 11:49:23 +1000 Subject: [PATCH 07/10] Fix issue#482 plagiarism_turnitin_config --- db/upgrade.php | 19 +++++++++++++++++++ version.php | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/db/upgrade.php b/db/upgrade.php index 3c656f5f..5ecc07d3 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -500,6 +500,25 @@ function xmldb_plagiarism_turnitin_upgrade($oldversion) { upgrade_plugin_savepoint(true, 2021081301, 'plagiarism', 'turnitin'); } + if ($oldversion < 2022032302) { + $table = new xmldb_table('plagiarism_turnitin_config'); + $index = new xmldb_index('config_hash', XMLDB_INDEX_UNIQUE, array('config_hash')); + $field = new xmldb_field('config_hash', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, 'value'); + if ($dbman->field_exists($table, $field)) { + // Double-check that there is no records with a NULL value. + if ($DB->count_records_select('plagiarism_turnitin_config', 'config_hash IS NULL') == 0) { + // Delete index if exists. + if ($dbman->index_exists($table, $index)) { + $dbman->drop_index($table, $index); + } + // Set config_hash to be NOT NULL, also set precision 255. + $dbman->change_field_notnull($table, $field); + } + } + + upgrade_plugin_savepoint(true, 2022032302, 'plagiarism', 'turnitin'); + } + return $result; } diff --git a/version.php b/version.php index 991c04a6..9229f77e 100644 --- a/version.php +++ b/version.php @@ -19,7 +19,7 @@ * @copyright 2012 iParadigms LLC */ -$plugin->version = 2022032301; +$plugin->version = 2022032302; $plugin->release = "3.5+"; $plugin->requires = 2018051700; $plugin->component = 'plagiarism_turnitin'; From 31830f9d7daac21706c12ac5861bafe8b295b677 Mon Sep 17 00:00:00 2001 From: David Winn Date: Fri, 22 Jul 2022 10:58:24 +0100 Subject: [PATCH 08/10] Unit test fixes --- classes/digitalreceipt/pp_receipt_message.php | 4 ++-- tests/classes/turnitin_assignment_class_test.php | 2 +- tests/classes/turnitin_user_class_test.php | 2 +- tests/modules/turnitin_assign_test.php | 2 +- tests/modules/turnitin_forum_test.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/classes/digitalreceipt/pp_receipt_message.php b/classes/digitalreceipt/pp_receipt_message.php index 9792abda..5cba8739 100644 --- a/classes/digitalreceipt/pp_receipt_message.php +++ b/classes/digitalreceipt/pp_receipt_message.php @@ -73,7 +73,7 @@ public function build_message($input) { $message->submission_date = $input['submission_date']; $message->submission_id = $input['submission_id']; - return format_string(get_string('pp_digital_receipt_message', 'plagiarism_turnitin', $message)); + return format_text(get_string('pp_digital_receipt_message', 'plagiarism_turnitin', $message)); } /** @@ -96,7 +96,7 @@ public function build_instructor_message($input) { $message->submission_date = $input['submission_date']; $message->submission_id = $input['submission_id']; - return format_string(get_string('receipt_instructor_copy', 'plagiarism_turnitin', $message)); + return format_text(get_string('receipt_instructor_copy', 'plagiarism_turnitin', $message)); } /** diff --git a/tests/classes/turnitin_assignment_class_test.php b/tests/classes/turnitin_assignment_class_test.php index e4649618..44d0850e 100644 --- a/tests/classes/turnitin_assignment_class_test.php +++ b/tests/classes/turnitin_assignment_class_test.php @@ -39,7 +39,7 @@ class plagiarism_turnitin_assignment_class_testcase extends advanced_testcase { /** * Set Overwrite mtrace to avoid output during the tests. */ - public function setup() { + public function setUp(): void { global $CFG; // Overwrite mtrace. diff --git a/tests/classes/turnitin_user_class_test.php b/tests/classes/turnitin_user_class_test.php index f668075b..d94a4448 100644 --- a/tests/classes/turnitin_user_class_test.php +++ b/tests/classes/turnitin_user_class_test.php @@ -42,7 +42,7 @@ class plagiarism_turnitin_user_class_testcase extends plagiarism_turnitin_test_l /** * Set Overwrite mtrace to avoid output during the tests. */ - public function setup() { + public function setUp(): void { // Stub a fake tii comms. $this->faketiicomms = $this->getMockBuilder(turnitin_comms::class) ->disableOriginalConstructor() diff --git a/tests/modules/turnitin_assign_test.php b/tests/modules/turnitin_assign_test.php index 447eb3cc..15e26956 100644 --- a/tests/modules/turnitin_assign_test.php +++ b/tests/modules/turnitin_assign_test.php @@ -38,7 +38,7 @@ class plagiarism_turnitin_assign_testcase extends advanced_testcase { /** * Create a course and assignment module instance */ - public function setup() { + public function setUp(): void { $this->course = $this->getDataGenerator()->create_course(); $params = array( 'course' => $this->course->id, diff --git a/tests/modules/turnitin_forum_test.php b/tests/modules/turnitin_forum_test.php index 5ad3a6d0..ecf75451 100644 --- a/tests/modules/turnitin_forum_test.php +++ b/tests/modules/turnitin_forum_test.php @@ -37,7 +37,7 @@ class plagiarism_turnitin_forum_testcase extends advanced_testcase { /** * Create a course and forum module instance */ - public function setup() { + public function setUp(): void { // Create a course, user and a forum. $course = $this->getDataGenerator()->create_course(); $user = $this->getDataGenerator()->create_user(); From 3e1792b8a0944e146bda7c8db11674f707a60916 Mon Sep 17 00:00:00 2001 From: David Winn Date: Fri, 22 Jul 2022 15:18:48 +0100 Subject: [PATCH 09/10] Versioning --- db/upgrade.php | 8 ++++---- version.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/db/upgrade.php b/db/upgrade.php index d9ca3743..618ea168 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -500,7 +500,7 @@ function xmldb_plagiarism_turnitin_upgrade($oldversion) { upgrade_plugin_savepoint(true, 2021081301, 'plagiarism', 'turnitin'); } - if ($oldversion < 2022032302) { + if ($oldversion < 2022072201) { $table = new xmldb_table('plagiarism_turnitin_config'); $index = new xmldb_index('config_hash', XMLDB_INDEX_UNIQUE, array('config_hash')); $field = new xmldb_field('config_hash', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, 'value'); @@ -516,10 +516,10 @@ function xmldb_plagiarism_turnitin_upgrade($oldversion) { } } - upgrade_plugin_savepoint(true, 2022032302, 'plagiarism', 'turnitin'); + upgrade_plugin_savepoint(true, 2022072201, 'plagiarism', 'turnitin'); } - if ($oldversion < 2022071800) { + if ($oldversion < 2022072202) { // Set userid to be NOT NULL. $table = new xmldb_table('plagiarism_turnitin_users'); $index = new xmldb_index('userid', XMLDB_INDEX_UNIQUE, array('userid')); @@ -552,7 +552,7 @@ function xmldb_plagiarism_turnitin_upgrade($oldversion) { } } - upgrade_plugin_savepoint(true, 2022071800, 'plagiarism', 'turnitin'); + upgrade_plugin_savepoint(true, 2022072202, 'plagiarism', 'turnitin'); } return $result; diff --git a/version.php b/version.php index 68250ca6..ef15ad47 100644 --- a/version.php +++ b/version.php @@ -19,7 +19,7 @@ * @copyright 2012 iParadigms LLC */ -$plugin->version = 2022071800; +$plugin->version = 2022072202; $plugin->release = "3.5+"; $plugin->requires = 2018051700; From 43374d60483d2dfabb140dbcbf35b50e09a2b86b Mon Sep 17 00:00:00 2001 From: David Winn Date: Mon, 25 Jul 2022 09:59:01 +0100 Subject: [PATCH 10/10] Release 2022072501 --- CHANGELOG.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ db/upgrade.php | 8 ++------ version.php | 2 +- 3 files changed, 52 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b2a4a2d..ae271486 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,52 @@ +### Date: 2022-July-25 +### Release: v2022072501 + +#### :zap: What's new + +--- + +We’ve had several community members actively contribute towards making the Moodle plagiarism plugin the best it can be, with some insightful and much appreciated pull requests. Check out all the latest improvements, with special thanks to our community members who have contributed towards them. + +#### Moodle Quizzes will perform better when many users take a quiz that involves essay-based questions + +When viewing a Moodle Quiz results, Turnitin would request the CMID (Course Module ID) multiple times, even after it had already been provided. This could cause classes to see performance issues when a larger class used essay-based questions as a part of their Moodle Quiz. This enhancement fixes the issue and users should expect to see increased performance when using Moodle Quizzes with larger classes now. + +With special thanks to [@aolley](https://github.com/aolley) for this contribution. + +#### Performance improvements when Turnitin isn’t enabled for a Moodle activity + +When Turnitin wasn’t enabled for a Moodle activity, multiple database calls would still be run for each user within the activity, resulting is a lot of unnecessary extra database load. This change removes these checks when Turnitin is not enabled. Users should expect to see some performance enhancements, particularly in larger classes. + +With special thanks to [@danmarsden](https://github.com/danmarsden) for this contribution. + +#### Database schema is now consistent when upgrading to a new version of the plugin + +This change fixes an issue where there was an alignment issue between the install and upgrade scripts, resulting in multiple is mismatches. + +With special thanks to [@golenkovm](https://github.com/golenkovm) and [@TomoTsuyuki](https://github.com/TomoTsuyuki) for the fix, and kristian-94 for their thorough initial investigation. + +#### Messages sent by Turnitin to instructors and students now apply the Moodle filters + +Filters can be used in Moodle to convert or change a message into a richer form of media. This includes creating links, converting mathematical formula into images, and even showing multiple languages at once on screen. + +Any messages sent by Turnitin will now work with these filters. + +With special thanks to [@izendegi](https://github.com/izendegi) for this contribution. + +#### Turnitin EULA prompt will now show at all times when using Moodle Forums + +When using a Moodle Forum, making an reply on the same page would not show the prompt to accept the Turnitin EULA for processing. The prompt would still be shown the first time the page is loaded. Users can now expect to see the EULA prompt on each interaction they would do in a forum that would potentially generate a Similarity Report if the EULA was accepted. + +With special thanks to [@jonof](https://github.com/jonof) for this contribution. + +#### Quiz attempt grades will set correct after opening the Similarity Report + +Opening the Similarity Report in a quiz attempt could in some situations alter the calculated grade for a student. User can expect for the Similarity Report to no longer affect the calculated grade. + +With special thanks again to [@jonof](https://github.com/jonof) for their contribution. + +--- + ### Date: 2022-March-23 ### Release: 2022032301 diff --git a/db/upgrade.php b/db/upgrade.php index 618ea168..05df7c75 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -500,7 +500,7 @@ function xmldb_plagiarism_turnitin_upgrade($oldversion) { upgrade_plugin_savepoint(true, 2021081301, 'plagiarism', 'turnitin'); } - if ($oldversion < 2022072201) { + if ($oldversion < 2022072501) { $table = new xmldb_table('plagiarism_turnitin_config'); $index = new xmldb_index('config_hash', XMLDB_INDEX_UNIQUE, array('config_hash')); $field = new xmldb_field('config_hash', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, 'value'); @@ -516,10 +516,6 @@ function xmldb_plagiarism_turnitin_upgrade($oldversion) { } } - upgrade_plugin_savepoint(true, 2022072201, 'plagiarism', 'turnitin'); - } - - if ($oldversion < 2022072202) { // Set userid to be NOT NULL. $table = new xmldb_table('plagiarism_turnitin_users'); $index = new xmldb_index('userid', XMLDB_INDEX_UNIQUE, array('userid')); @@ -552,7 +548,7 @@ function xmldb_plagiarism_turnitin_upgrade($oldversion) { } } - upgrade_plugin_savepoint(true, 2022072202, 'plagiarism', 'turnitin'); + upgrade_plugin_savepoint(true, 2022072501, 'plagiarism', 'turnitin'); } return $result; diff --git a/version.php b/version.php index ef15ad47..b1dbcf98 100644 --- a/version.php +++ b/version.php @@ -19,7 +19,7 @@ * @copyright 2012 iParadigms LLC */ -$plugin->version = 2022072202; +$plugin->version = 2022072501; $plugin->release = "3.5+"; $plugin->requires = 2018051700;