Permalink
Browse files

MDL-32899: Assignment upgrade tool fails to upgrade some online text …

…submissions

This is a fix for onlinetext assignments with submissions that have feedback but no
actual submission (data1 and data2 are NULL)
  • Loading branch information...
1 parent 3388649 commit d82bb44d74b087ffedd8850d2b7347a331ef5ffe Damyon Wiese committed with danpoltawski May 10, 2012
Showing with 9 additions and 0 deletions.
  1. +9 −0 mod/assign/submission/onlinetext/locallib.php
@@ -310,6 +310,15 @@ public function upgrade(context $oldcontext, stdClass $oldassignment, stdClass $
$onlinetextsubmission->submission = $submission->id;
$onlinetextsubmission->assignment = $this->assignment->get_instance()->id;
+
+ if ($onlinetextsubmission->onlinetext === null) {
+ $onlinetextsubmission->onlinetext = '';
+ }
+
+ if ($onlinetextsubmission->onlineformat === null) {
+ $onlinetextsubmission->onlineformat = editors_get_preferred_format();
+ }
+
if (!$DB->insert_record('assignsubmission_onlinetext', $onlinetextsubmission) > 0) {
$log .= get_string('couldnotconvertsubmission', 'mod_assign', $submission->userid);
return false;

0 comments on commit d82bb44

Please sign in to comment.