From d56dd3b7ff8ff9b55df1a1325cb47f3d03ba8550 Mon Sep 17 00:00:00 2001 From: John McGettrick Date: Mon, 27 Jul 2015 15:59:01 +0100 Subject: [PATCH 1/5] Hotfix to update missed successful DM submissions --- db/upgrade.php | 9 ++++++--- version.php | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/db/upgrade.php b/db/upgrade.php index fc35067e..5454c5ca 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -153,7 +153,7 @@ function xmldb_plagiarism_turnitin_upgrade($oldversion) { upgrade_plugin_savepoint(true, 2014012413, 'plagiarism', 'turnitin'); } - if ($oldversion < 2015040106) { + if ($oldversion < 2015040107) { upgrade_dm_successful_uploads(); } @@ -163,9 +163,12 @@ function xmldb_plagiarism_turnitin_upgrade($oldversion) { function upgrade_dm_successful_uploads() { global $DB, $CFG; - // Update successful submissions from Dan Marsden's plugin + // Update successful submissions from Dan Marsden's plugin with incorrect statuscode. $DB->execute("UPDATE ".$CFG->prefix."plagiarism_turnitin_files SET statuscode = 'success', lastmodified = ".time()." WHERE statuscode = '51'"); - // Update error codes with submissions from Dan Marsden's plugin + // Update the lastmodified timestamp from all successful submissions from Dan Marsden's plugin. + $DB->execute("UPDATE ".$CFG->prefix."plagiarism_turnitin_files SET lastmodified = ".time()." WHERE statuscode = 'success' AND orcapable IS NULL"); + + // Update error codes with submissions from Dan Marsden's plugin. $DB->execute("UPDATE ".$CFG->prefix."plagiarism_turnitin_files SET statuscode = 'error' WHERE statuscode != 'success' AND statuscode != 'pending'"); } \ No newline at end of file diff --git a/version.php b/version.php index 49e15d1a..88760db5 100644 --- a/version.php +++ b/version.php @@ -5,7 +5,7 @@ * and open the template in the editor. */ -$plugin->version = 2015040106; +$plugin->version = 2015040107; $plugin->release = "2.3+"; $plugin->requires = 2012062500.00; $plugin->cron = 300; From dccc5e5a00933afc2691dcacc1fdc9d19bd6c73c Mon Sep 17 00:00:00 2001 From: John McGettrick Date: Tue, 28 Jul 2015 08:49:22 +0100 Subject: [PATCH 2/5] Use last modified to check whether updating DM submissions. --- db/upgrade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/upgrade.php b/db/upgrade.php index 5454c5ca..163f7018 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -167,7 +167,7 @@ function upgrade_dm_successful_uploads() { $DB->execute("UPDATE ".$CFG->prefix."plagiarism_turnitin_files SET statuscode = 'success', lastmodified = ".time()." WHERE statuscode = '51'"); // Update the lastmodified timestamp from all successful submissions from Dan Marsden's plugin. - $DB->execute("UPDATE ".$CFG->prefix."plagiarism_turnitin_files SET lastmodified = ".time()." WHERE statuscode = 'success' AND orcapable IS NULL"); + $DB->execute("UPDATE ".$CFG->prefix."plagiarism_turnitin_files SET lastmodified = ".time()." WHERE statuscode = 'success' AND lastmodified = 0"); // Update error codes with submissions from Dan Marsden's plugin. $DB->execute("UPDATE ".$CFG->prefix."plagiarism_turnitin_files SET statuscode = 'error' WHERE statuscode != 'success' AND statuscode != 'pending'"); From 3ff2fe671678febdcb8516dd0a5b0206b3e270dc Mon Sep 17 00:00:00 2001 From: John McGettrick Date: Thu, 30 Jul 2015 15:14:17 +0100 Subject: [PATCH 3/5] Don't show EULA if we have a prev submission. --- lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib.php b/lib.php index ba770612..02e5177c 100644 --- a/lib.php +++ b/lib.php @@ -703,7 +703,7 @@ public function get_links($linkarray) { $output .= $OUTPUT->box_start('tii_links_container'); // Show the EULA for a student if necessary. - if ($linkarray["userid"] == $USER->id) { + if ($linkarray["userid"] == $USER->id && !$plagiarismfile) { $eula = ""; static $userid; From bcd6e658fa6a2f834d452ad18327848a1932031a Mon Sep 17 00:00:00 2001 From: John McGettrick Date: Thu, 30 Jul 2015 15:21:20 +0100 Subject: [PATCH 4/5] Check for empty external id when showing EULA. --- lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib.php b/lib.php index 02e5177c..453f6c69 100644 --- a/lib.php +++ b/lib.php @@ -703,7 +703,7 @@ public function get_links($linkarray) { $output .= $OUTPUT->box_start('tii_links_container'); // Show the EULA for a student if necessary. - if ($linkarray["userid"] == $USER->id && !$plagiarismfile) { + if ($linkarray["userid"] == $USER->id && empty($plagiarismfile->externalid)) { $eula = ""; static $userid; From 94177595a63eb2dd4cc7dfeba67b532edeb18e90 Mon Sep 17 00:00:00 2001 From: John McGettrick Date: Thu, 30 Jul 2015 15:47:59 +0100 Subject: [PATCH 5/5] Update Changelog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61bb7ced..645bfa4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ Releases before version 2015040106 will refer to changes made to the Turnitin's other Moodle plugins as well; the direct module and block. +### Date: 2015-July-31 +### Release: v2015040107 + +- Verified against Moodle 2.9 +- Fixes: + - Account for Shared Rubrics being returned by the API. + - Don't show the EULA for files previously submitted to Turnitin. + +--- + ### Date: 2015-June-29 ### Release: v2015040106