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:
Tim Hunt
2012-01-12 12:10:08 +00:00
parent 389cb58948
commit 18dff75754
5 changed files with 30 additions and 11 deletions
+1 -1
View File
@@ -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);
}
/**