Merge branch 'MDL-35337' of git://github.com/netspotau/moodle-mod_assign

This commit is contained in:
Dan Poltawski 2012-09-24 10:44:00 +08:00
commit 15f4a83b3a
2 changed files with 12 additions and 3 deletions

View File

@ -73,8 +73,10 @@ class restore_assign_activity_structure_step extends restore_activity_structure_
$data->timemodified = $this->apply_date_offset($data->timemodified);
$data->allowsubmissionsfromdate = $this->apply_date_offset($data->allowsubmissionsfromdate);
$data->duedate = $this->apply_date_offset($data->duedate);
if ($data->teamsubmissiongroupingid > 0) {
if (!empty($data->teamsubmissiongroupingid)) {
$data->teamsubmissiongroupingid = $this->get_mappingid('grouping', $data->teamsubmissiongroupingid);
} else {
$data->teamsubmissiongroupingid = 0;
}
if (!isset($data->cutoffdate)) {
@ -111,8 +113,10 @@ class restore_assign_activity_structure_step extends restore_activity_structure_
if ($data->userid > 0) {
$data->userid = $this->get_mappingid('user', $data->userid);
}
if ($data->groupid > 0) {
if (!empty($data->groupid)) {
$data->groupid = $this->get_mappingid('group', $data->groupid);
} else {
$data->groupid = 0;
}
$newitemid = $DB->insert_record('assign_submission', $data);
@ -139,7 +143,11 @@ class restore_assign_activity_structure_step extends restore_activity_structure_
$data->timecreated = $this->apply_date_offset($data->timecreated);
$data->userid = $this->get_mappingid('user', $data->userid);
$data->grader = $this->get_mappingid('user', $data->grader);
$data->extensionduedate = $this->apply_date_offset($data->extensionduedate);
if (!empty($data->extensionduedate)) {
$data->extensionduedate = $this->apply_date_offset($data->extensionduedate);
} else {
$data->extensionduedate = 0;
}
$newitemid = $DB->insert_record('assign_grades', $data);

View File

@ -1957,6 +1957,7 @@ class assign {
$grade->locked = 0;
$grade->grade = -1;
$grade->grader = $USER->id;
$grade->extensionduedate = 0;
$gid = $DB->insert_record('assign_grades', $grade);
$grade->id = $gid;
return $grade;