Merge branch 'MDL-57228' of git://github.com/timhunt/moodle

This commit is contained in:
Jake Dallimore 2017-10-04 13:42:51 +08:00
commit 32c369818c
3 changed files with 82 additions and 22 deletions

View file

@ -802,14 +802,8 @@ class structure {
}
// Update section fist slots.
$DB->execute("
UPDATE {quiz_sections}
SET firstslot = firstslot + ?
WHERE quizid = ?
AND firstslot > ?
AND firstslot < ?
", array($headingmovedirection, $this->get_quizid(),
$headingmoveafter, $headingmovebefore));
quiz_update_section_firstslots($this->get_quizid(), $headingmovedirection,
$headingmoveafter, $headingmovebefore);
// If any pages are now empty, remove them.
$emptypages = $DB->get_fieldset_sql("
@ -915,12 +909,7 @@ class structure {
question_delete_question($slot->questionid);
}
$DB->execute("
UPDATE {quiz_sections}
SET firstslot = firstslot - 1
WHERE quizid = ?
AND firstslot > ?
", array($this->get_quizid(), $slotnumber));
quiz_update_section_firstslots($this->get_quizid(), -1, $slotnumber);
unset($this->questions[$slot->questionid]);
$this->refresh_page_numbers_and_update_db();