Skip to content

Commit 5cb6966

Browse files
Merge pull request #450 from turnitin/develop
Develop to master for release v2019060601
2 parents ea650af + b248a88 commit 5cb6966

16 files changed

+59
-67
lines changed

CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
### Date: 2019-June-06
2+
### Release: v2019060601
3+
4+
#### :wrench: Fixes and enhancements
5+
6+
#### Bug fixes
7+
8+
We’ve been doing bug fixing behind the scenes to improve the usability of the Moodle Plagiarism Plugin.
9+
10+
This includes fixing a bug that was erroneously displaying rubric options when creating a forum in Moodle with the Plagiarism Plugin enabled. This has been resolved and rubric options will no longer be available during forum creation.
11+
12+
Download the latest version from the above link.
13+
14+
---
15+
116
### Date: 2019-May-02
217
### Release: v2019050201
318

classes/turnitin_view.class.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ public function draw_settings_tab_menu($currenttab, $notice = null) {
8989
* @param type $plugin_defaults
9090
* @return type
9191
*/
92-
public function add_elements_to_settings_form($mform, $course, $location = "activity", $cmid = 0, $currentrubric = 0) {
93-
global $CFG, $PAGE, $USER, $DB;
92+
public function add_elements_to_settings_form($mform, $course, $location = "activity", $modulename = "", $cmid = 0, $currentrubric = 0) {
93+
global $PAGE, $USER, $DB;
9494

9595
// Include JS strings
9696
$PAGE->requires->string_for_js('changerubricwarning', 'plagiarism_turnitin');
@@ -100,7 +100,7 @@ public function add_elements_to_settings_form($mform, $course, $location = "acti
100100
$configwarning = '';
101101
$rubrics = array();
102102

103-
if ($location == "activity") {
103+
if ($location == "activity" && $modulename != 'mod_forum') {
104104
$instructor = new turnitin_user($USER->id, 'Instructor');
105105

106106
$instructor->join_user_to_class($course->turnitin_cid);
@@ -282,7 +282,7 @@ public function add_elements_to_settings_form($mform, $course, $location = "acti
282282
$mform->addHelpButton('plagiarism_locked_message', 'locked_message', 'plagiarism_turnitin');
283283
}
284284

285-
if ($location == "activity" && $config->plagiarism_turnitin_usegrademark) {
285+
if ($location == "activity" && $modulename != "mod_forum" && $config->plagiarism_turnitin_usegrademark) {
286286
if (!empty($currentrubric)) {
287287
$attachrubricstring = get_string('attachrubric', 'plagiarism_turnitin');
288288
if (!isset($rubrics[$attachrubricstring][$currentrubric])) {
@@ -297,6 +297,7 @@ public function add_elements_to_settings_form($mform, $course, $location = "acti
297297
'plagiarism_turnitin'), 'id' => 'rubric_manager_form'
298298
)
299299
);
300+
300301
$rubricmanagerlink = html_writer::tag('div', $rubricmanagerlink, array('class' => 'row_rubric_manager'));
301302
$mform->addElement('selectgroups', 'plagiarism_rubric', get_string('attachrubric', 'plagiarism_turnitin'), $rubrics);
302303
$mform->addElement('static', 'rubric_link', '', $rubricmanagerlink);

db/install.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<FIELD NAME="orcapable" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" PREVIOUS="submissiontype" NEXT="errorcode"/>
2424
<FIELD NAME="errorcode" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" PREVIOUS="orcapable" NEXT="errormsg"/>
2525
<FIELD NAME="errormsg" TYPE="text" LENGTH="medium" NOTNULL="false" SEQUENCE="false" PREVIOUS="errorcode" NEXT="student_read"/>
26-
<FIELD NAME="student_read" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" PREVIOUS="errormsg" NEXT="gm_feedback"/>
26+
<FIELD NAME="student_read" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" PREVIOUS="errormsg" NEXT="gm_feedback"/>
2727
<FIELD NAME="gm_feedback" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="student_read" NEXT="duedate_report_refresh"/>
2828
<FIELD NAME="duedate_report_refresh" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="0 => Report does not need updating, 1 => Originality report needs to be updated, 2 => Report has been updated" PREVIOUS="gm_feedback"/>
2929
</FIELDS>

db/upgrade.php

+12-3
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ function xmldb_plagiarism_turnitin_upgrade($oldversion) {
9292
}
9393
}
9494
}
95-
9695
upgrade_plugin_savepoint(true, 2014012405, 'plagiarism', 'turnitin');
9796
}
9897

@@ -187,6 +186,7 @@ function xmldb_plagiarism_turnitin_upgrade($oldversion) {
187186
if (!$dbman->field_exists($table, $field)) {
188187
$dbman->add_field($table, $field);
189188
}
189+
upgrade_plugin_savepoint(true, 2016011101, ‘plagiarism’, ‘turnitin’);
190190
}
191191

192192
if ($oldversion < 2016011104) {
@@ -195,6 +195,7 @@ function xmldb_plagiarism_turnitin_upgrade($oldversion) {
195195
if (!$dbman->field_exists($table, $field)) {
196196
$dbman->add_field($table, $field);
197197
}
198+
upgrade_plugin_savepoint(true, 2016011104, ‘plagiarism’, ‘turnitin’);
198199
}
199200

200201
if ($oldversion < 2016011105) {
@@ -238,9 +239,10 @@ function xmldb_plagiarism_turnitin_upgrade($oldversion) {
238239
if (!$dbman->field_exists($table, $field)) {
239240
$dbman->add_field($table, $field);
240241
}
242+
upgrade_plugin_savepoint(true, 2016091402, ‘plagiarism’, ‘turnitin’);
241243
}
242244

243-
if ($oldversion < 2017013101) {
245+
if ($oldversion < 2017012601) {
244246
$table = new xmldb_table('plagiarism_turnitin_files');
245247

246248
// Due to an inconsistency with install and upgrade scripts, some users will
@@ -267,9 +269,11 @@ function xmldb_plagiarism_turnitin_upgrade($oldversion) {
267269

268270
// Remove old PP event from the database if it exists.
269271
$DB->delete_records('task_scheduled', array('component' => 'plagiarism_turnitin', 'classname' => '\plagiarism_turnitin\task\plagiarism_turnitin_task'));
272+
273+
upgrade_plugin_savepoint(true, 2017012601, 'plagiarism', 'turnitin');
270274
}
271275

272-
if ($oldversion < 2017012601) {
276+
if ($oldversion < 2017013101) {
273277
// Add new column that has to be unique.
274278
$table = new xmldb_table('plagiarism_turnitin_config');
275279
$field = new xmldb_field('config_hash', XMLDB_TYPE_CHAR, '100', null, null, null, null, 'value');
@@ -283,11 +287,15 @@ function xmldb_plagiarism_turnitin_upgrade($oldversion) {
283287
// Add hash as key after update.
284288
$key = new xmldb_key('config_hash', XMLDB_KEY_UNIQUE, array('config_hash'));
285289
$dbman->add_key($table, $key);
290+
291+
upgrade_plugin_savepoint(true, 2017013101, 'plagiarism', 'turnitin');
286292
}
287293

288294
if ($oldversion < 2019031301) {
289295
// Reset all error code 13s so that we are on a clean slate with the new implementation.
290296
$DB->execute("UPDATE ".$CFG->prefix."plagiarism_turnitin_files SET statuscode = 'success', errorcode = NULL WHERE errorcode = 13");
297+
298+
upgrade_plugin_savepoint(true, 2019031301, 'plagiarism', 'turnitin');
291299
}
292300

293301
if ($oldversion < 2019050201) {
@@ -391,6 +399,7 @@ function xmldb_plagiarism_turnitin_upgrade($oldversion) {
391399
plagiarism_turnitin_activitylog('Unable to copy users table during version upgrade because they already exist.', 'PP_UPGRADE');
392400
}
393401
}
402+
upgrade_plugin_savepoint(true, 2019050201, 'plagiarism', 'turnitin');
394403
}
395404

396405
return $result;

lib.php

+13-45
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
}
3030

3131
// Constants.
32-
define('PLAGIARISM_TURNITIN_MAX_FILE_UPLOAD_SIZE', 41943040);
32+
define('PLAGIARISM_TURNITIN_MAX_FILE_UPLOAD_SIZE', 104857600);
3333
define('PLAGIARISM_TURNITIN_NUM_RECORDS_RETURN', 500);
3434
define('PLAGIARISM_TURNITIN_CRON_SUBMISSIONS_LIMIT', 100);
3535
define('PLAGIARISM_TURNITIN_REPORT_GEN_SPEED_NUM_RESUBMISSIONS', 3);
@@ -320,7 +320,7 @@ public function get_form_elements_module($mform, $context, $modulename = "") {
320320
if ($PAGE->pagetype != 'course-editbulkcompletion' && $PAGE->pagetype != 'course-editdefaultcompletion') {
321321
// Create/Edit course in Turnitin and join user to class.
322322
$course = $this->get_course_data($cmid, $COURSE->id);
323-
$turnitinview->add_elements_to_settings_form($mform, $course, "activity", $cmid, $plagiarismvalues["plagiarism_rubric"]);
323+
$turnitinview->add_elements_to_settings_form($mform, $course, "activity", $modulename, $cmid, $plagiarismvalues["plagiarism_rubric"]);
324324
}
325325

326326
// Disable all plagiarism elements if turnitin is not enabled.
@@ -1886,47 +1886,6 @@ public function sync_tii_assignment($cm, $coursetiiid, $workflowcontext = "site"
18861886
}
18871887
}
18881888

1889-
/**
1890-
* Call functions to be run by cron
1891-
*/
1892-
public function cron() {
1893-
global $DB, $CFG, $pptaskcall;
1894-
1895-
// 2.7 onwards we would like to be called from task calls.
1896-
if ( $CFG->version > 2014051200 AND !$pptaskcall ) {
1897-
mtrace("[Turnitin Plagiarism Plugin] Aborted Cron call because of active task mode");
1898-
return;
1899-
}
1900-
1901-
// Reset task call flag.
1902-
if ( $pptaskcall ) {
1903-
$pptaskcall = false;
1904-
}
1905-
1906-
// Don't attempt to call Turnitin if a connection to Turnitin could not be established.
1907-
if (!$this->test_turnitin_connection()) {
1908-
mtrace(get_string('ppeventsfailedconnection', 'plagiarism_turnitin'));
1909-
return false;
1910-
}
1911-
1912-
// Update scores by separate submission type.
1913-
$submissiontypes = array('file', 'text_content', 'forum_post');
1914-
foreach ($submissiontypes as $submissiontype) {
1915-
try {
1916-
$typefield = ($CFG->dbtype == "oci") ? " to_char(submissiontype) " : " submissiontype ";
1917-
$submissions = $DB->get_records_select('plagiarism_turnitin_files',
1918-
" statuscode = ? AND ".$typefield." = ?
1919-
AND ( similarityscore IS NULL OR duedate_report_refresh = 1 )
1920-
AND ( orcapable = ? OR orcapable IS NULL ) ",
1921-
array('success', $submissiontype, 1), 'externalid DESC');
1922-
$this->cron_update_scores($submissiontype, $submissions);
1923-
} catch (Exception $ex) {
1924-
mtrace("Exception in TII cron while updating scores for '$submissiontype' submission types: ".$ex);
1925-
}
1926-
}
1927-
return true;
1928-
}
1929-
19301889
/**
19311890
* Updates the database field duedate_report_refresh for any given submission ID.
19321891
* @param int $id - the ID of the submission to update.
@@ -1946,14 +1905,23 @@ public function set_duedate_report_refresh($id, $newvalue) {
19461905
* @param array $submissions - the submissions to be processed
19471906
* @return boolean
19481907
*/
1949-
public function cron_update_scores($submissiontype = 'file', $submissions) {
1908+
public function cron_update_scores() {
19501909
global $DB;
19511910

19521911
$submissionids = array();
19531912
$reportsexpected = array();
19541913
$assignmentids = array();
19551914
$validatedsubmissions = array();
19561915

1916+
$submissions = $DB->get_records_select(
1917+
'plagiarism_turnitin_files',
1918+
'statuscode = ?
1919+
AND ( similarityscore IS NULL OR duedate_report_refresh = 1 )
1920+
AND ( orcapable = ? OR orcapable IS NULL ) ',
1921+
array('success', 1),
1922+
'externalid DESC'
1923+
);
1924+
19571925
// Add submission ids to the request.
19581926
foreach ($submissions as $tiisubmission) {
19591927

@@ -2800,7 +2768,7 @@ public static function plagiarism_set_config($data, $property) {
28002768
*/
28012769
function plagiarism_turnitin_update_reports() {
28022770
$pluginturnitin = new plagiarism_plugin_turnitin();
2803-
return $pluginturnitin->cron();
2771+
return $pluginturnitin->cron_update_scores();
28042772
}
28052773

28062774
/**

tests/behat/assignment_any_file_type.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@plugin @plagiarism @plagiarism_turnitin @plagiarism_turnitin_sanity @plagiarism_turnitin_assignment @plagiarism_turnitin_assignment_any_file_type
2-
Feature: Plagiarism plugin works with a Moodle Assignment
2+
Feature: Plagiarism plugin works with a Moodle Assignment for a filetype which won't generate an originality report
33
In order to allow students to send assignment submissions to Turnitin
44
As a user
55
I need to create an assignment with the plugin enabled and the assignment to launch successfully.

tests/behat/assignment_drafts.feature

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@plugin @plagiarism @plagiarism_turnitin @plagiarism_turnitin_assignment @plagiarism_turnitin_assignment_drafts
2-
Feature: Plagiarism plugin works with a Moodle Assignment
3-
In order to allow students to send assignment submissions to Turnitin
2+
Feature: Plagiarism plugin works with a Moodle Assignment utilising the draft submission feature
3+
In order to allow students to send draft assignment submissions to Turnitin
44
As a user
55
I need to create an assignment with the plugin enabled and the assignment to launch successfully.
66

tests/behat/assignment_groups.feature

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@plugin @plagiarism @plagiarism_turnitin @plagiarism_turnitin_assignment @plagiarism_turnitin_assignment_groups
2-
3-
Feature: Group assignment submissions
2+
Feature: Plagiarism plugin works with a Moodle Assignment for group submissions
43
In order to allow students to work collaboratively on an assignment
54
As a teacher
65
I need to group submissions in groups

tests/behat/assignment_resubmission.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@plugin @plagiarism @plagiarism_turnitin @plagiarism_turnitin_assignment @plagiarism_turnitin_assignment_resubmission
2-
Feature: Plagiarism plugin works with a Moodle Assignment
2+
Feature: Plagiarism plugin works with a Moodle Assignment when making a resubmission
33
In order to allow students to resubmit assignment submissions to Turnitin
44
As a user
55
I need to create an assignment with the plugin enabled, resubmissions allowed and the student can resubmit.

tests/behat/eula.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@plugin @plagiarism @plagiarism_turnitin @plagiarism_turnitin_smoke @plagiarism_turnitin_eula
2-
Feature: Plagiarism plugin works with a Moodle Assignment
2+
Feature: Plagiarism plugin works with a Moodle Assignment allowing EULA acceptance
33
In order to allow students to submit to Moodle, they must accept the EULA.
44
As a user
55
I need to create an assignment with the plugin enabled and the assignment to launch successfully.

tests/behat/installed.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@plugin @plagiarism @plagiarism_turnitin @plagiarism_turnitin_smoke @plagiarism_turnitin_installed
2-
Feature: Installation succeeds
2+
Feature: Plagiarism plugin can be installed and enabled
33
In order to use this plugin
44
As a user
55
I need the installation to work and plagiarism plugins to be enabled

tests/behat/pseudo_submission.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@plugin @plagiarism @plagiarism_turnitin @plagiarism_turnitin_pseudo
2-
Feature: Plagiarism plugin works with a Moodle Assignment
2+
Feature: Plagiarism plugin works with a Moodle Assignment and utilise student data privacy
33
In order to allow students to send assignment submissions to Turnitin with pseudo enabled at account level
44
As a user
55
I need to create an assignment with the plugin enabled and the assignment to launch successfully and for student names to be masked in the inbox.

tests/behat/rubric.feature

Whitespace-only changes.

tests/classes/turnitin_user_class_test.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
*
3636
* @package turnitin
3737
*/
38-
class plagiarism_turnitin_user_class_testcase extends test_lib {
38+
class plagiarism_turnitin_user_class_testcase extends plagiarism_turnitin_test_lib {
3939

4040
public $faketiicomms;
4141

@@ -112,4 +112,4 @@ public function test_unlink_user() {
112112
$user = $DB->get_record('plagiarism_turnitin_users', array('id' => $testuser["joins"][0]));
113113
$this->assertEquals(0, $user->turnitin_uid);
114114
}
115-
}
115+
}

tests/generator/lib.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* @copyright 2017 Turnitin
3535
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3636
*/
37-
abstract class test_lib extends advanced_testcase {
37+
abstract class plagiarism_turnitin_test_lib extends advanced_testcase {
3838

3939
/**
4040
* Creates a number of test plagiarism_turnitin users, creates an equivalent moodle user for each, and handles the database association work.
@@ -77,4 +77,4 @@ public function join_test_user($plagiarism_turnitin_user) {
7777

7878
return $plagiarism_turnitin_user_id;
7979
}
80-
}
80+
}

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 = 2019050201;
22+
$plugin->version = 2019060601;
2323
$plugin->release = "3.1+";
2424
$plugin->requires = 2016052300;
2525
$plugin->component = 'plagiarism_turnitin';

0 commit comments

Comments
 (0)