Skip to content

Commit

Permalink
Merge pull request #629 from turnitin/develop
Browse files Browse the repository at this point in the history
Release 2022072501
  • Loading branch information
dwinn authored Jul 25, 2022
2 parents fd36a2b + 44d7a4d commit 9c2c533
Show file tree
Hide file tree
Showing 14 changed files with 213 additions and 13 deletions.
49 changes: 49 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion amd/build/eula.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amd/build/eula.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions amd/src/eula.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions classes/digitalreceipt/pp_receipt_message.php
Original file line number Diff line number Diff line change
Expand Up @@ -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_text(get_string('pp_digital_receipt_message', 'plagiarism_turnitin', $message));
}

/**
Expand All @@ -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_text(get_string('receipt_instructor_copy', 'plagiarism_turnitin', $message));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion classes/modules/turnitin_quiz.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
51 changes: 51 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,57 @@ function xmldb_plagiarism_turnitin_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2021081301, 'plagiarism', 'turnitin');
}

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');
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);
}
}

// 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, 2022072501, 'plagiarism', 'turnitin');
}

return $result;
}

Expand Down
6 changes: 3 additions & 3 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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"]);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/classes/turnitin_assignment_class_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion tests/classes/turnitin_user_class_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion tests/modules/turnitin_assign_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tests/modules/turnitin_forum_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading

0 comments on commit 9c2c533

Please sign in to comment.