Permalink
Browse files

MDL-37676 Use course grade category if mapping fails for manual grade…

… items
  • Loading branch information...
1 parent b9ef2c9 commit 7a257bb0f74d91b62044d02d012633f2e69411e5 @woolardfa woolardfa committed Jan 24, 2013
Showing with 5 additions and 0 deletions.
  1. +5 −0 backup/moodle2/restore_stepslib.php
@@ -150,6 +150,11 @@ protected function process_grade_item($data) {
if ($data->itemtype=='manual') {
// manual grade items store category id in categoryid
$data->categoryid = $this->get_mappingid('grade_category', $data->categoryid, NULL);
+ // if mapping failed put in course's grade category
+ if (NULL == $data->categoryid) {
+ $coursecat = grade_category::fetch_course_category($this->get_courseid());
+ $data->categoryid = $coursecat->id;
+ }
} else if ($data->itemtype=='course') {
// course grade item stores their category id in iteminstance
$coursecat = grade_category::fetch_course_category($this->get_courseid());

0 comments on commit 7a257bb

Please sign in to comment.