Skip to content

Commit 58b088b

Browse files
authored
Merge pull request #601 from turnitin/develop
Release 2021091501
2 parents c825826 + ded664f commit 58b088b

File tree

5 files changed

+54
-21
lines changed

5 files changed

+54
-21
lines changed

CHANGELOG.md

+29-8
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,56 @@
1+
### Date: 2021-September-15
2+
### Release: 2021091501
3+
4+
#### :wrench: Fixes and enhancements
5+
6+
#### Empty grades in Turnitin will not override Moodle grading
7+
8+
When you had completed grading in Moodle and someone opened the Turnitin viewer for the submission, if no grade had been set in Turnitin, the Moodle grade would be lost. Now, the grade within Moodle will be retained and an ungraded Turnitin viewer can be opened without it causing any problems.
9+
10+
Note: If a grade is removed from Turnitin, it will no longer remove it from Moodle as the viewer will then be ‘empty’ and we assume that the Moodle grade is intended.
11+
12+
#### Only the essay type question in a Moodle Quiz will request a Similarity Report
13+
14+
We’ve refined this feature to only request a Similarity Report for Essay type questions. Turnitin would only ever create a report for these types of questions anyway, but a request was sent for all question types. This could cause bigger classes to become sluggish. You should notice that bigger classes that use a lot of quizzes are much easier to navigate now.
15+
16+
Thanks to Dan Marsden And Alex Morris for highlighting and providing a fix for this.
17+
18+
#### Test connection now will check the connection to Turnitin at all times
19+
20+
Previously, Test Connection wouldn’t work until the plugin was configured. This could potentially cause confusion with users assuming that as no error had been shown the connection must already be established. We’ve changed it so that the Test Connection feature will always look to see if a successful connection has been made when checking.
21+
122
### Date: 2021-August-13
223
### Release: 2021081301
324

425
#### :wrench: Fixes and enhancements
526

6-
####Classes will create successfully
27+
#### Classes will create successfully
728
A bug potentially resulted in classes created in Moodle to not sync correctly when we tried to create them in Turnitin. We’ve fixed this problem and you will now be able to create classes again.
829

930
### Date: 2021-June-08
1031
### Release: 2021060801
1132

1233
#### :wrench: Fixes and enhancements
1334

14-
####Support for Moodle 3.11
35+
#### Support for Moodle 3.11
1536
You can now confidently use this integration with Moodle 3.11.
1637

17-
####Use Turnitin with Moodle Quizzes
38+
#### Use Turnitin with Moodle Quizzes
1839
We can now check for similarity on any files that are uploaded as a part of a Moodle quiz.
1940

20-
####Cron tasks will no longer run when Moodle is not configured
41+
#### Cron tasks will no longer run when Moodle is not configured
2142
Thanks to alexmorrisnz for the pull request!
2243

23-
####Removed grades change the grade in Moodle
44+
#### Removed grades change the grade in Moodle
2445
When a grade is removed from Turnitin, this removal will also be reflected within Moodle as the submission being ungraded.
2546

26-
####Turnitin classes will now be expired along with a Moodle course
47+
#### Turnitin classes will now be expired along with a Moodle course
2748
We will now sync dates in Moodle with the Turnitin database. When the Moodle course expires, we will close out those classes in Turnitin. This will free up the active student count for those classes.
2849

29-
####Create or access Moodle assignments, forums, and workshops when Turnitin is disabled
50+
#### Create or access Moodle assignments, forums, and workshops when Turnitin is disabled
3051
If Turnitin is disabled for an assignment, forum, or workshop and Turnitin is unavailable by having the wrong configuration options or being under maintenance, then an error message would be shown. This bug has been fixed, and Turnitin being unreachable will no longer impact your ability to create or access your content.
3152

32-
####Changes to the Moodle course name will be reflected everywhere
53+
#### Changes to the Moodle course name will be reflected everywhere
3354
When a Moodle course title is changed, this will now be updated in Turnitin too. This will include the digital receipts students receive when they submit their paper.
3455

3556
---

ajax.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,12 @@
300300
if (empty($config)) {
301301
$config = plagiarism_plugin_turnitin::plagiarism_turnitin_admin_config();
302302
}
303-
if ($config->plagiarism_turnitin_enablediagnostic != 2) {
303+
if (!isset($config->plagiarism_turnitin_enablediagnostic)) {
304304
$turnitincomms->set_diagnostic(0);
305+
} else {
306+
if ($config->plagiarism_turnitin_enablediagnostic != 2) {
307+
$turnitincomms->set_diagnostic(0);
308+
}
305309
}
306310

307311
$tiiapi = $turnitincomms->initialise_api(true);

classes/turnitin_comms.class.php

+8-3
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,23 @@ class turnitin_comms {
3838
public function __construct($accountid = null, $accountshared = null, $url = null) {
3939
$config = plagiarism_plugin_turnitin::plagiarism_turnitin_admin_config();
4040

41-
$tiiapiurl = (substr($config->plagiarism_turnitin_apiurl, -1) == '/') ? substr($config->plagiarism_turnitin_apiurl, 0, -1) : $config->plagiarism_turnitin_apiurl;
41+
if (!is_null($url)) {
42+
$this->tiiapiurl = $url;
43+
} else {
44+
$this->tiiapiurl = (substr($config->plagiarism_turnitin_apiurl, -1) == '/')
45+
? substr($config->plagiarism_turnitin_apiurl, 0, -1) : $config->plagiarism_turnitin_apiurl;
46+
}
4247

4348
$this->tiiintegrationid = 12;
4449
$this->tiiaccountid = is_null($accountid) ? $config->plagiarism_turnitin_accountid : $accountid;
45-
$this->tiiapiurl = is_null($url) ? $tiiapiurl : $url;
4650
$this->tiisecretkey = is_null($accountshared) ? $config->plagiarism_turnitin_secretkey : $accountshared;
4751

4852
if (empty($this->tiiaccountid) || empty($this->tiiapiurl) || empty($this->tiisecretkey)) {
4953
plagiarism_turnitin_print_error( 'configureerror', 'plagiarism_turnitin' );
5054
}
5155

52-
$this->diagnostic = $config->plagiarism_turnitin_enablediagnostic;
56+
$this->diagnostic = (isset($config->plagiarism_turnitin_enablediagnostic))
57+
? $config->plagiarism_turnitin_enablediagnostic : 1;
5358
$this->langcode = $this->get_lang();
5459
}
5560

lib.php

+11-8
Original file line numberDiff line numberDiff line change
@@ -1357,10 +1357,10 @@ private function update_submission($cm, $submissionid, $tiisubmission) {
13571357

13581358
// Identify if an update is required for the similarity score and grade.
13591359
if ($submissiondata->similarityscore != $plagiarismfile->similarityscore ||
1360-
$submissiondata->grade != $plagiarismfile->grade ||
1361-
$submissiondata->orcapable != $plagiarismfile->orcapable ||
1362-
$submissiondata->student_read != $plagiarismfile->student_read ||
1363-
$submissiondata->gm_feedback != $plagiarismfile->gm_feedback) {
1360+
$submissiondata->grade != $plagiarismfile->grade ||
1361+
$submissiondata->orcapable != $plagiarismfile->orcapable ||
1362+
$submissiondata->student_read != $plagiarismfile->student_read ||
1363+
$submissiondata->gm_feedback != $plagiarismfile->gm_feedback) {
13641364
$updaterequired = true;
13651365
}
13661366

@@ -1427,7 +1427,7 @@ private function update_submission($cm, $submissionid, $tiisubmission) {
14271427
array('iteminstance' => $cm->instance, 'itemmodule' => $cm->modname,
14281428
'courseid' => $cm->course, 'itemnumber' => 0));
14291429

1430-
if (!empty($gradeitem) && $gbupdaterequired) {
1430+
if (!is_null($plagiarismfile->grade) && !empty($gradeitem) && $gbupdaterequired) {
14311431
$return = $this->update_grade($cm, $tiisubmission, $submissiondata->userid);
14321432
}
14331433
}
@@ -1444,11 +1444,11 @@ private function update_grade($cm, $submission, $userid) {
14441444
global $DB, $USER, $CFG;
14451445
$return = true;
14461446

1447-
if ($cm->modname != 'forum') {
1447+
if (!is_null($submission->getGrade()) && $cm->modname != 'forum') {
14481448
// Module grade object.
14491449
$grade = new stdClass();
14501450
// If submission has multiple content/files in it then get average grade.
1451-
// Ignore files no longer part of submission.
1451+
// Ignore NULL grades and files no longer part of submission.
14521452

14531453
// Create module object.
14541454
$moduleclass = "turnitin_".$cm->modname;
@@ -1482,7 +1482,7 @@ private function update_grade($cm, $submission, $userid) {
14821482
}
14831483
$grade->grade = (!is_null($averagegrade) && $gradescounted > 0) ? (int)($averagegrade / $gradescounted) : null;
14841484
} else {
1485-
$grade->grade = ($submission->getGrade() == '') ? null : $submission->getGrade();
1485+
$grade->grade = $submission->getGrade();
14861486
}
14871487

14881488
// Check whether submission is a group submission - only applicable to assignment module.
@@ -2563,6 +2563,9 @@ public function event_handler($eventdata) {
25632563
$attempt = quiz_attempt::create($eventdata['objectid']);
25642564
foreach ($attempt->get_slots() as $slot) {
25652565
$qa = $attempt->get_question_attempt($slot);
2566+
if ($qa->get_question()->get_type_name() != 'essay') {
2567+
continue;
2568+
}
25662569
$eventdata['other']['content'] = $qa->get_response_summary();
25672570

25682571
// Queue text content.

version.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* @copyright 2012 iParadigms LLC
2020
*/
2121

22-
$plugin->version = 2021081301;
22+
$plugin->version = 2021091501;
2323
$plugin->release = "3.5+";
2424
$plugin->requires = 2018051700;
2525
$plugin->component = 'plagiarism_turnitin';

0 commit comments

Comments
 (0)