mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 02:16:41 +02:00
MDL-54802 mod_quiz: Add validation to require passing grade greater than 0
This commit adds a form validation to prevent the creation of quizzes using zero or null grade to pass when using require passing grade.
This commit is contained in:
parent
1f2744851f
commit
981356b23d
4 changed files with 34 additions and 1 deletions
|
@ -533,6 +533,13 @@ class mod_quiz_mod_form extends moodleform_mod {
|
|||
}
|
||||
}
|
||||
|
||||
if (array_key_exists('completion', $data) && $data['completion'] == COMPLETION_TRACKING_AUTOMATIC) {
|
||||
// Show an error if require passing grade was selected and the grade to pass was setted to 0.
|
||||
if ($data['completionpass'] == 1 && (empty($data['gradepass']) || grade_floatval($data['gradepass']) == 0)) {
|
||||
$errors['gradepass'] = get_string('gradetopassnotset', 'quiz');
|
||||
}
|
||||
}
|
||||
|
||||
// Check the boundary value is a number or a percentage, and in range.
|
||||
$i = 0;
|
||||
while (!empty($data['feedbackboundaries'][$i] )) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue