Permalink
Browse files

MDL-17524 Merging from HEAD

Deleting a calculated question delete datasetdefinitions shared by other question
  • Loading branch information...
1 parent 538c7fe commit a2816b744735287b92ede2ad0000154c7a5f7d99 pichetp committed Dec 4, 2008
Showing with 5 additions and 0 deletions.
  1. +5 −0 question/type/calculated/questiontype.php
@@ -343,10 +343,15 @@ function delete_question($questionid) {
delete_records("question_numerical_units", "question", $questionid);
if ($datasets = get_records('question_datasets', 'question', $questionid)) {
foreach ($datasets as $dataset) {
+ if (! get_records_select(
+ 'question_datasets',
+ "question != $questionid
+ AND datasetdefinition = $dataset->datasetdefinition;")){
delete_records('question_dataset_definitions', 'id', $dataset->datasetdefinition);
delete_records('question_dataset_items', 'definition', $dataset->datasetdefinition);
}
}
+ }
delete_records("question_datasets", "question", $questionid);
return true;
}

0 comments on commit a2816b7

Please sign in to comment.