Skip to content

Commit 59cdec4

Browse files
authored
Merge pull request #396 from turnitin/develop
Release 2017103001
2 parents 7eed759 + c8e4301 commit 59cdec4

23 files changed

+240
-253
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ node_modules/
77
/.settings/
88
/.buildpath
99
/.project
10+
/.idea

CHANGELOG.md

+54
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,57 @@
1+
### Date: 2017-October-30
2+
### Release: v2017103001
3+
4+
V1 to V2 Moodle Migration Tool
5+
6+
**The Moodle Migration Tool is now in early access mode!** - Before making the Moodle Migration Tool available to all of our Moodle users, we asked a subset of users to test the tool and advise us of any issues or errors they may have stumbled across during their experimenting. We'd like to thank all of our testers for their useful comments; they've helped us make the tool even better!
7+
8+
Calling all administrators! To access the Moodle migration tool and enable instructor migration, visit our guide.
9+
10+
Below, you can find several updates we've made to the tool based on the issues raised by our testers:
11+
12+
- Updated migration tool setting information
13+
- We've made improvements to the migration workflow
14+
- We've made some table adjustments
15+
- Fixed an issue causing the grade book to unsuccessfully migrate
16+
17+
**Updated migration tool setting information** - We've updated the information behind the question mark icon connected to the 'Migration action at assignment launch' setting; this referred to old functionality in the Moodle Migration Tool. The text now reflects the current state of the tool. Apologies if you became a little confused!
18+
19+
**We've made improvements to the migration workflow** - We've made the migration workflow clearer by prompting the user to migrate on all V1 assignments. Even if you navigate away from the assignment, you'll be prompted again when you return. We hope this helps make your migration a smooth and simple one.
20+
21+
**We've made some table adjustments** - The table of migrated V1 assignments was appearing a little unkempt, so we tidied up by setting the table width. The table now looks much more aesthetically pleasing!
22+
23+
**Fixed an issue causing the grade book to unsuccessfully migrate** - When migrating we found a potential issue that would cause the migration of grade book to fail which would lead to issues with the migration of assignments. We've preemptively fixed this so you will be able to migrate your assignments without issue.
24+
25+
We've also been working on...
26+
27+
- Fixed a bug preventing student enrollment
28+
- Removed the visibility of the delete icon after submission
29+
- Anonymous marking grades now pass to the grade book in all databases
30+
- Unit tests now pass successfully
31+
- Fixed several incorrectly named variables
32+
33+
**Fixed a bug preventing student enrollment** - We received an alert that the Enrol All Students button accessible via the Turnitin Students tab wasn't functioning correctly; this removed the ability for students enrolled in the same class via Turnitin.com or TurnitinUK.com to submit to their Moodle Direct V2 assignment. We identified a missing parameter causing the issue and simply reinserted it. The button now works as intended. Thanks to @neillm for his input!
34+
35+
> A parameter is a piece of information passed to a program by a user or another program; this information can be a name, number, or a selected option. Parameters have an effect on the operation of the program receiving them.
36+
37+
**Removed the visibility of the delete icon after submission** - We received several reports from an institution concerning the presence of the submission delete icon in the student submission inbox. For assignments with resubmissions disabled, students who'd submitted an incorrect file type managed to delete and resubmit their paper. Although this is useful for students who've made a genuine submission error, this was not intended functionality.
38+
39+
We also heard that by allowing late submissions in an assignment, this enabled students to delete and resubmit their paper after the post date. This unintentionally allowed students to resubmit after any instructor marking or grading had taken place. The delete icon has now been removed, meaning students will only be able to submit following the permissions set by their instructor.
40+
41+
**Anonymous marking grades now pass to the grade book** - We noticed that grades failed to populate the grade book for papers submitted to an assignment with anonymous marking enabled. The call to send these grades failed in the Microsoft SQL database and produced an error. Not to worry! All grades now send to the grade book as expected.
42+
43+
> SQL statements are used to perform tasks, such as updating data within a database (updating the grade book with grades!), or retrieving data from a database.
44+
45+
**Unit tests now pass successfully** - With thanks to @danmarsden for his work on fixing some of our broken unit tests. These improvements help to instill user confidence in Moodle Direct V2.
46+
47+
> Unit tests involve testing certain functions and areas – or units – of code. This gives developers the ability to verify that software functions work as intended.
48+
49+
**Fixed several incorrectly named variables** - We've implemented some fixes kindly provided by @sk-unikent which tidied up several variable issues.
50+
51+
> Variables are used to store information for easy manipulation and reference in a computer program. Rather than entering data directly into a program, a variable is used to represent data. When a program is executed, a variable is replaced with actual data. For example, firstName is a variable because it can be referenced and replaced with the actual first name of an individual.
52+
53+
---
54+
155
### Date: 2017-August-09
256
### Release: v2017080901
357

activate_migration.php

-48
This file was deleted.

ajax.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
$turnitinuser = $DB->get_record('turnitintooltwo_users', array('userid' => $USER->id));
128128

129129
// Build user object for update.
130-
$eulauser = new object();
130+
$eulauser = new \stdClass();
131131
$eulauser->id = $turnitinuser->id;
132132
$eulauser->user_agreement_accepted = 0;
133133
if ($message == 'turnitin_eula_accepted') {

backup/moodle2/backup_turnitintooltwo_stepslib.php

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
class backup_turnitintooltwo_activity_structure_step extends backup_activity_structure_step {
3232

3333
protected function define_structure() {
34+
// Required otherwise Moodle unit test core_calendar_container_testcase calendar/tests/container_test.php will fail.
35+
if (defined('PHPUNIT_TEST') && PHPUNIT_TEST) {
36+
set_config('accountid', 'NULL', 'turnitintooltwo');
37+
}
38+
3439
$config = turnitintooltwo_admin_config();
3540

3641
// To know if we are including userinfo.

classes/v1migration/v1migration.php

+24-1
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ public static function output_settings_form($enablesetting = true) {
701701
* @return object $activation - db record of the migration activation row inserted into config_plugins.
702702
*/
703703
public static function activate_migration() {
704-
global $DB, $CFG;
704+
global $DB;
705705
$migration_enabled_params = array(
706706
'plugin' => 'turnitintooltwo',
707707
'name' => 'migration_enabled'
@@ -722,4 +722,27 @@ public static function activate_migration() {
722722

723723
return $activation;
724724
}
725+
726+
public static function check_account($accountid) {
727+
global $CFG;
728+
729+
$config = turnitintooltwo_admin_config();
730+
731+
$tiiapiurl = (substr($config->apiurl, -1) == '/') ? substr($config->apiurl, 0, -1) : $config->apiurl;
732+
733+
$ch = curl_init();
734+
curl_setopt($ch, CURLOPT_URL, $tiiapiurl."/api/rest/check?lang=en_us&operation=mdl-migration&account=".$accountid);
735+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
736+
737+
if (isset($CFG->proxyhost) AND !empty($CFG->proxyhost)) {
738+
curl_setopt($ch, CURLOPT_PROXY, $CFG->proxyhost.':'.$CFG->proxyport);
739+
}
740+
if (isset($CFG->proxyuser) AND !empty($CFG->proxyuser)) {
741+
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
742+
curl_setopt($ch, CURLOPT_PROXYUSERPWD, sprintf('%s:%s', $CFG->proxyuser, $CFG->proxypassword));
743+
}
744+
745+
curl_exec($ch);
746+
curl_close($ch);
747+
}
725748
}

db/upgrade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ function xmldb_turnitintooltwo_upgrade($oldversion) {
238238
$dbman->add_key($table, $key);
239239
}
240240

241-
if ($oldversion < 2017071901) {
241+
if ($oldversion < 2017103001) {
242242
$table = new xmldb_table('turnitintooltwo');
243243
// Add field for flagging whether a V2 assignment is a legacy V1 assignment.
244244
$field = new xmldb_field('legacy', XMLDB_TYPE_INTEGER, '1', false, null, false, '0', 'anongradebook');

jquery/turnitintooltwo.js

+8
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,14 @@
736736
return response.msg;
737737
} else if (response.field == "maxmarks") {
738738
$('#refresh_' + response.partid).click();
739+
740+
// Update the gradebook.
741+
$.ajax({
742+
type: "POST",
743+
url: M.cfg.wwwroot + "/mod/turnitintooltwo/ajax.php",
744+
dataType: "json",
745+
data: { action: "sync_all_submissions", assignment: $('#assignment_id').html(), sesskey: M.cfg.sesskey }
746+
});
739747
} else if (response.field == "partname") {
740748
var tabId = $(this).parentsUntil('.ui-tabs-panel').parent().attr('aria-labelledby');
741749
$('#' + tabId).text(newValue);

jquery/turnitintooltwo.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jquery/turnitintooltwo_migration_tool.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ $(document).ready(function(){
66
"type": "POST",
77
"url": M.cfg.wwwroot + "/mod/turnitintooltwo/ajax.php",
88
"data": {
9-
action: "check_migrated",
9+
action: "check_migrated",
1010
turnitintoolid: $("#migrate_type").data("turnitintoolid"),
1111
sesskey: M.cfg.sesskey
1212
},
1313
"success": function(data) {
14-
if (data.migrated == true) {
14+
if (data.migrated === true) {
1515
window.location.href = M.cfg.wwwroot + "/mod/turnitintooltwo/view.php?id="+data.v2id;
1616
} else {
1717
displayMigrationModal();
@@ -66,7 +66,7 @@ function migrate(courseid, turnitintoolid) {
6666
$.colorbox.close();
6767
}
6868
$('#migration_alert').hide();
69-
window.location.href = M.cfg.wwwroot + "/mod/turnitintooltwo/view.php?id="+data.id;
69+
window.location.href = M.cfg.wwwroot + "/mod/turnitintooltwo/view.php?id="+data.id+"&migrated=1";
7070
},
7171
error: function(error) {
7272
var data = error.responseJSON;

0 commit comments

Comments
 (0)