Skip to content

Commit

Permalink
MDL-37676 Use course grade category if mapping fails for manual grade…
Browse files Browse the repository at this point in the history
… items
  • Loading branch information
woolardfa committed Mar 22, 2013
1 parent 8bb0c27 commit 2e83fee
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions backup/moodle2/restore_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 2e83fee

Please sign in to comment.