mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-32499 gradingform_rubric Avoid backup/restore of rubric fillings without an existing criteria
This commit is contained in:
parent
55a568fa7d
commit
b4b6fc9155
@ -106,7 +106,12 @@ class backup_gradingform_rubric_plugin extends backup_gradingform_plugin {
|
|||||||
|
|
||||||
// Set sources to populate the data
|
// Set sources to populate the data
|
||||||
|
|
||||||
$filling->set_source_table('gradingform_rubric_fillings',
|
// Binding criterionid to ensure it's existence
|
||||||
|
$filling->set_source_sql('SELECT rf.*
|
||||||
|
FROM {gradingform_rubric_fillings} rf
|
||||||
|
JOIN {grading_instances} gi ON gi.id = rf.instanceid
|
||||||
|
JOIN {gradingform_rubric_criteria} rc ON rc.id = rf.criterionid AND gi.definitionid = rc.definitionid
|
||||||
|
WHERE rf.instanceid = :instanceid',
|
||||||
array('instanceid' => backup::VAR_PARENTID));
|
array('instanceid' => backup::VAR_PARENTID));
|
||||||
|
|
||||||
// no need to annotate ids or files yet (one day when remark field supports
|
// no need to annotate ids or files yet (one day when remark field supports
|
||||||
|
@ -109,6 +109,9 @@ class restore_gradingform_rubric_plugin extends restore_gradingform_plugin {
|
|||||||
$data->criterionid = $this->get_mappingid('gradingform_rubric_criterion', $data->criterionid);
|
$data->criterionid = $this->get_mappingid('gradingform_rubric_criterion', $data->criterionid);
|
||||||
$data->levelid = $this->get_mappingid('gradingform_rubric_level', $data->levelid);
|
$data->levelid = $this->get_mappingid('gradingform_rubric_level', $data->levelid);
|
||||||
|
|
||||||
|
if (!empty($data->criterionid)) {
|
||||||
$DB->insert_record('gradingform_rubric_fillings', $data);
|
$DB->insert_record('gradingform_rubric_fillings', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user