mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
MDL-17524 Deleting a calculated question delete datasetdefinitions shared by other question
This commit is contained in:
parent
74c640b3a7
commit
57db70affb
@ -632,6 +632,10 @@ class question_calculated_qtype extends default_questiontype {
|
|||||||
$DB->delete_records("question_numerical_units", array("question" => $questionid));
|
$DB->delete_records("question_numerical_units", array("question" => $questionid));
|
||||||
if ($datasets = $DB->get_records('question_datasets', array('question' => $questionid))) {
|
if ($datasets = $DB->get_records('question_datasets', array('question' => $questionid))) {
|
||||||
foreach ($datasets as $dataset) {
|
foreach ($datasets as $dataset) {
|
||||||
|
if (!$DB->get_records_select(
|
||||||
|
'question_datasets',
|
||||||
|
"question != ?
|
||||||
|
AND datasetdefinition = ?;", array($questionid, $dataset->datasetdefinition))){
|
||||||
$DB->delete_records('question_dataset_definitions', array('id' => $dataset->datasetdefinition));
|
$DB->delete_records('question_dataset_definitions', array('id' => $dataset->datasetdefinition));
|
||||||
$DB->delete_records('question_dataset_items', array('definition' => $dataset->datasetdefinition));
|
$DB->delete_records('question_dataset_items', array('definition' => $dataset->datasetdefinition));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user