Skip to content

Commit

Permalink
Merge branch 'MDL-36130' of git://github.com/aolley/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
Aparup Banerjee committed Oct 31, 2012
2 parents cedf976 + ac9ac1f commit 9b18e58
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mod/assign/upgradelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ public function upgrade_assignment($oldassignmentid, & $log) {
}
$completiondone = true;

// Migrate log entries so we don't lose them.
$logparams = array('cmid' => $oldcoursemodule->id, 'course' => $oldcoursemodule->course);
$DB->set_field('log', 'module', 'assign', $logparams);
$DB->set_field('log', 'cmid', $newcoursemodule->id, $logparams);


// copy all the submission data (and get plugins to do their bit)
$oldsubmissions = $DB->get_records('assignment_submissions', array('assignment'=>$oldassignmentid));
Expand Down Expand Up @@ -269,6 +274,10 @@ public function upgrade_assignment($oldassignmentid, & $log) {
$DB->update_record('course_completion_criteria', $criteria);
}
}
// Roll back the log changes
$logparams = array('cmid' => $newcoursemodule->id, 'course' => $newcoursemodule->course);
$DB->set_field('log', 'module', 'assignment', $logparams);
$DB->set_field('log', 'cmid', $oldcoursemodule->id, $logparams);
// roll back the advanced grading update
if ($gradingarea) {
foreach ($gradeidmap as $newgradeid => $oldsubmissionid) {
Expand Down

0 comments on commit 9b18e58

Please sign in to comment.