Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on Moodle Import #181

Closed
sharpchi opened this issue Jul 8, 2016 · 7 comments
Closed

Error on Moodle Import #181

sharpchi opened this issue Jul 8, 2016 · 7 comments

Comments

@sharpchi
Copy link

sharpchi commented Jul 8, 2016

Starting this year we are creating new versions of Moodle courses for each academic year and getting the lecturers to run the Moodle Import process (Course administration -> Import) to bring over content from the previous year.

When they've selected the Moodle course they wish to import from, and then click on "Jump to final step", we are sometimes getting the following error message:

turnitintooltwo/There was an error trying to create the assignment in Turnitin

Fault Code: invaliddata | File: [dirroot]/mod/turnitintooltwo/sdk/assignmentsoap.class.php | Line: 33 | Message: date_start - start date can not be more than 1 year in the past. | Code: 0

More information about this error

Debug info: 
Error code: There was an error trying to create the assignment in Turnitin<br/><br/>Fault Code: invaliddata | File: [dirroot]/mod/turnitintooltwo/sdk/assignmentsoap.class.php | Line: 33 | Message: date_start - start date can not be more than 1 year in the past. 
| Code: 0
$a contents: There was an error trying to create the assignment in Turnitin<br/><br/>Fault Code: invaliddata | File: [dirroot]/mod/turnitintooltwo/sdk/assignmentsoap.class.php | Line: 33 | Message: date_start - start date can not be more than 1 year in the past. 
| Code: 0
Stack trace:
line 488 of /lib/setuplib.php: moodle_exception thrown
line 683 of /mod/turnitintooltwo/lib.php: call to print_error()
line 149 of /mod/turnitintooltwo/turnitintooltwo_comms.class.php: call to turnitintooltwo_print_error()
line 842 of /mod/turnitintooltwo/turnitintooltwo_assignment.class.php: call to turnitintooltwo_comms::handle_exceptions()
line 1385 of /mod/turnitintooltwo/turnitintooltwo_assignment.class.php: call to turnitintooltwo_assignment::create_tii_assignment()
line 125 of /mod/turnitintooltwo/backup/moodle2/restore_turnitintooltwo_activity_task.class.php: call to turnitintooltwo_assignment->edit_moodle_assignment()
line 111 of /backup/util/plan/restore_task.class.php: call to restore_turnitintooltwo_activity_task->after_restore()
line 193 of /backup/util/plan/restore_plan.class.php: call to restore_task->execute_after_restore()
line 121 of /backup/moodle2/restore_final_task.class.php: call to restore_plan->execute_after_restore()
line 821 of /backup/moodle2/restore_stepslib.php: call to restore_final_task->launch_execute_after_restore()
line 34 of /backup/util/plan/restore_execution_step.class.php: call to restore_execute_after_restore->define_execution()
line 181 of /backup/util/plan/base_task.class.php: call to restore_execution_step->execute()
line 177 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
line 167 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
line 333 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
line 163 of /backup/import.php: call to restore_controller->execute_plan()

This seems to indicate that the source course had a TII2 activity with a start date of more than a year from this moment.

I've run a few tests with old Moodle courses, but this doesn't seem to be consistently producing this error, so I don't know if there's another factor involved in this.

The error doesn't stop the Import process from running, entirely. In fact it seems to import in the TII2 activity, but when you click on it you get the following message:
tii2error

I looked into this a little bit, and though there's an entry in the course_module table, there isn't an entry in the turnitintooltwo table:

select cm.id as cmid,
    c.fullname,
    c.idnumber,
    m.name as modulename,
    tii2.name as tii2name,
    tii2.id as tii2id,
    cm.*
from mdl_course_modules as cm 
JOIN mdl_course as c on c.id=cm.course
JOIN mdl_modules as m on m.id=cm.module
LEFT JOIN mdl_turnitintooltwo as tii2 ON cm.instance = tii2.id
WHERE m.name = 'turnitintooltwo' AND tii2.id IS null;

produces:
tii2_record

even though course_module.instance has been set.

It looks to me as though the restore function aborts, but doesn't clean up properly. Since this ends up with a broken link, I would say this is a bug to be fixed.

As far as we are concerned, we are happy if TII2 activities are not imported, but there's no way of automatically stopping that, currently.

I am aware that instead of clicking "Jump to final step" the lecturer could click on "Next" and deselect the TII activities, but you try getting lecturers to jump through those hoops! It's not going to happen.

@barry-matthias
Copy link

Afternoon

I work for blackboard and we can confirm this issue occurs using version 2016011105 of the assignment module, the error which gets generated is as per below

Debug info:
Error code: There was an error trying to create the assignment in Turnitin

Fault Code: invaliddata | File: [dirroot]/mod/turnitintooltwo/sdk/assignmentsoap.class.php | Line: 33 | Message: date_start - start date can not be more than 1 year in the past.
| Code: 0
$a contents: There was an error trying to create the assignment in Turnitin

Fault Code: invaliddata | File: [dirroot]/mod/turnitintooltwo/sdk/assignmentsoap.class.php | Line: 33 | Message: date_start - start date can not be more than 1 year in the past.
| Code: 0
Stack trace

This is being caused by the public function createAssignment( $assignment ) function as the code cant tell if it is being called by the moodle restore or import library below is the entire call stack for this error which should show the parent functions
line 488 of /lib/setuplib.php: moodle_exception thrown
line 683 of /mod/turnitintooltwo/lib.php: call to print_error()
line 149 of /mod/turnitintooltwo/turnitintooltwo_comms.class.php: call to turnitintooltwo_print_error()
line 842 of /mod/turnitintooltwo/turnitintooltwo_assignment.class.php: call to turnitintooltwo_comms::handle_exceptions()
line 1385 of /mod/turnitintooltwo/turnitintooltwo_assignment.class.php: call to turnitintooltwo_assignment::create_tii_assignment()
line 125 of /mod/turnitintooltwo/backup/moodle2/restore_turnitintooltwo_activity_task.class.php: call to turnitintooltwo_assignment->edit_moodle_assignment()
line 111 of /backup/util/plan/restore_task.class.php: call to restore_turnitintooltwo_activity_task->after_restore()
line 193 of /backup/util/plan/restore_plan.class.php: call to restore_task->execute_after_restore()
line 121 of /backup/moodle2/restore_final_task.class.php: call to restore_plan->execute_after_restore()
line 717 of /backup/moodle2/restore_stepslib.php: call to restore_final_task->launch_execute_after_restore()
line 34 of /backup/util/plan/restore_execution_step.class.php: call to restore_execute_after_restore->define_execution()
line 190 of /backup/util/plan/base_task.class.php: call to restore_execution_step->execute()
line 177 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
line 167 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
line 333 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()

@dwinn
Copy link
Contributor

dwinn commented Aug 30, 2016

Hi @sharpchi and @barry-matthias ,

We have fixed this in our current development build so it will go out with the next release of the V2 plugin.

@sharpchi
Copy link
Author

Thanks for letting us know. I'm not entirely sure it is fixed, though. In the turnitintooltwo_assignment.class.php file you have this line:

if (($restore) && ($attribute < strtotime("-1 year"))) {

which checks the $attribute value. I would expect that value to be a timestamp, but $attribute is set just a few lines up to:

$attribute = "maxmarks".$i;

Would you mind checking please?

@dwinn
Copy link
Contributor

dwinn commented Aug 30, 2016

Hi @sharpchi ,

Thanks for pointing that out, after looking at it myself I do indeed see a bug in our fix. We haven't done our full sweep of QA and automations yet for the next release so we hadn't spotted it yet.

We will amend this before the release.

@sharpchi
Copy link
Author

So, I think you need something like this:

$attribute = "dtstart".$i;
if (($restore) && ($this->turnitintooltwo->$attribute < strtotime("-1 year"))) {

@dwinn
Copy link
Contributor

dwinn commented Sep 1, 2016

Hi @sharpchi ,

Yeah this is the fix I had in mind. From my testing the fix you propose does work as intended. We'll get it through QA as soon as we can as we aim to release soon.

@jmcgettrick
Copy link
Contributor

Fixed in v2016091401

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants