MDL-31095 quiz editing: only set quiz->grade to 0 if really necessary.
It is only necessary when there are (non-preview) attempts. However, after making this change we have to ensure users cannot start attempts when ->grade > 0 and ->sumgrades = 0. Display ->grade on the order and paging tab of edit.php, so it is clear what is going on when you are using that tab. Finally, improve the error message a student gets if they try to start a quiz with no questions.
This commit is contained in:
@@ -248,8 +248,8 @@ function quiz_add_page_break_after($layout, $questionid) {
|
||||
function quiz_save_new_layout($quiz) {
|
||||
global $DB;
|
||||
$DB->set_field('quiz', 'questions', $quiz->questions, array('id' => $quiz->id));
|
||||
quiz_update_sumgrades($quiz);
|
||||
quiz_delete_previews($quiz);
|
||||
quiz_update_sumgrades($quiz);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user