the delete function delete all datasetdefiniton used by this question without testing if they are shared by other questions.
if ($datasets = get_records('question_datasets', 'question', $questionid)) {
foreach ($datasets as $dataset)
}
changing this in HEAD to
if ($datasets = $DB->get_records('question_datasets', array('question' => $questionid))) {
foreach ($datasets as $dataset) {
if (!$DB->get_records_select( // no other questions sharing this datasetdefinition
'question_datasets',
"question != ?
AND datasetdefinition = ?;", array($questionid, $dataset->datasetdefinition)))
}
}
solve the problem.
will merge down to 1.6
We can conclude that either shared datasetdefinition are not so often used or that such calculated questions are too precious to be deleted ...