Skip to content
Browse files

MDL-17524 Merging from HEAD

Deleting a calculated question delete datasetdefinitions shared by other question
  • Loading branch information...
1 parent da24670 commit 58c748b35586f8db04b62c9694c08314b599ff12 pichetp committed Dec 4, 2008
Showing with 7 additions and 2 deletions.
  1. +7 −2 question/type/calculated/questiontype.php
View
9 question/type/calculated/questiontype.php
@@ -468,8 +468,13 @@ function delete_question($questionid) {
delete_records("question_numerical_units", "question", $questionid);
if ($datasets = get_records('question_datasets', 'question', $questionid)) {
foreach ($datasets as $dataset) {
- delete_records('question_dataset_definitions', 'id', $dataset->datasetdefinition);
- delete_records('question_dataset_items', 'definition', $dataset->datasetdefinition);
+ 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);

0 comments on commit 58c748b

Please sign in to comment.
Something went wrong with that request. Please try again.