mirror of
https://github.com/moodle/moodle.git
synced 2025-03-19 15:10:05 +01:00
MDL-61614 Quiz: Deleting a quiz slot should delete its random tags
This commit is contained in:
parent
66aa172cbb
commit
3090719d7d
@ -914,6 +914,7 @@ class structure {
|
||||
$maxslot = $DB->get_field_sql('SELECT MAX(slot) FROM {quiz_slots} WHERE quizid = ?', array($this->get_quizid()));
|
||||
|
||||
$trans = $DB->start_delegated_transaction();
|
||||
$DB->delete_records('quiz_slot_tags', array('slotid' => $slot->id));
|
||||
$DB->delete_records('quiz_slots', array('id' => $slot->id));
|
||||
for ($i = $slot->slot + 1; $i <= $maxslot; $i++) {
|
||||
$DB->set_field('quiz_slots', 'slot', $i - 1,
|
||||
|
@ -183,7 +183,9 @@ function quiz_delete_instance($id) {
|
||||
WHERE slot.quizid = ? AND q.qtype = ?";
|
||||
$questionids = $DB->get_fieldset_sql($sql, array($quiz->id, 'random'));
|
||||
|
||||
// We need to do this before we try and delete randoms, otherwise they would still be 'in use'.
|
||||
// We need to do the following deletes before we try and delete randoms, otherwise they would still be 'in use'.
|
||||
$quizslots = $DB->get_fieldset_select('quiz_slots', 'id', 'quizid = ?', array($quiz->id));
|
||||
$DB->delete_records_list('quiz_slot_tags', 'slotid', $quizslots);
|
||||
$DB->delete_records('quiz_slots', array('quizid' => $quiz->id));
|
||||
$DB->delete_records('quiz_sections', array('quizid' => $quiz->id));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user