Skip to content

Commit

Permalink
Merge branch 'MDL-74516_311' of https://github.com/stronk7/moodle int…
Browse files Browse the repository at this point in the history
…o MOODLE_311_STABLE
  • Loading branch information
junpataleta committed Jul 4, 2022
2 parents 287d513 + 1271286 commit 93e30fb
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
6 changes: 2 additions & 4 deletions course/moodleform_mod.php
Expand Up @@ -889,10 +889,9 @@ protected function add_rating_settings($mform, int $itemnumber) {
}

// Grade to pass.
$mform->addElement('text', $gradepassfieldname, get_string('gradepass', 'grades'));
$mform->addElement('float', $gradepassfieldname, get_string('gradepass', 'grades'));
$mform->addHelpButton($gradepassfieldname, 'gradepass', 'grades');
$mform->setDefault($gradepassfieldname, '');
$mform->setType($gradepassfieldname, PARAM_RAW);
$mform->hideIf($gradepassfieldname, $assessedfieldname, 'eq', '0');
$mform->hideIf($gradepassfieldname, "{$scalefieldname}[modgrade_type]", 'eq', 'none');
}
Expand Down Expand Up @@ -1066,10 +1065,9 @@ public function standard_grading_coursemodule_elements() {
}

// Grade to pass.
$mform->addElement('text', $gradepassfieldname, get_string($gradepassfieldname, 'grades'));
$mform->addElement('float', $gradepassfieldname, get_string($gradepassfieldname, 'grades'));
$mform->addHelpButton($gradepassfieldname, $gradepassfieldname, 'grades');
$mform->setDefault($gradepassfieldname, '');
$mform->setType($gradepassfieldname, PARAM_RAW);
$mform->hideIf($gradepassfieldname, "{$gradefieldname}[modgrade_type]", 'eq', 'none');
}
}
Expand Down
33 changes: 33 additions & 0 deletions mod/quiz/tests/behat/completion_condition_passing_grade.feature
Expand Up @@ -53,3 +53,36 @@ Feature: Set a quiz to be marked complete when the student passes
And I am on "Course 1" course homepage
And I navigate to "Reports > Activity completion" in current page administration
And "Completed" "icon" should exist in the "Student 1" "table_row"

Scenario Outline: Verify that gradepass, together with completionpassgrade are validated correctly
Given the following "language customisations" exist:
| component | stringid | value |
| core_langconfig | decsep | <decsep> |
And the following "activity" exist:
| activity | name | course | idnumber | gradepass | completion | completionpass |
| quiz | Oh, grades, passgrades and floats| C1 | ohgrades | <gradepass>| 2 | <completionpass> |
When I am on the "ohgrades" "quiz activity editing" page logged in as "teacher1"
And I expand all fieldsets
And I set the field "Grade to pass" to "<gradepass>"
And I set the field "completionusegrade" to "1"
And I set the field "completionpass" to "<completionpass>"
And I press "Save and display"
Then I should see "<seen>"
And I should not see "<notseen>"

Examples:
| gradepass | completionpass | decsep | seen | notseen | outcome |
| | 0 | . | method: Highest | Save and display | ok |
| | 1 | . | not yet have a grade | method: Highest | completion-err |
| 0 | 0 | . | method: Highest | Save and display | ok |
| 0 | 1 | . | not yet have a grade | method: Highest | completion-err |
| aaa | 0 | . | must enter a number | method: Highest | number-err |
| aaa | 1 | . | must enter a number | method: Highest | number-err |
| 200 | 0 | . | can not be greater | method: Highest | grade-big-err |
| 200 | 1 | . | can not be greater | method: Highest | grade-big-err |
| 5.55 | 0 | . | 5.55 out of 100 | Save and display | ok |
| 5.55 | 1 | . | 5.55 out of 100 | Save and display | ok |
| 5#55 | 0 | . | must enter a number | method: Highest | number-err |
| 5#55 | 1 | . | must enter a number | method: Highest | number-err |
| 5#55 | 0 | # | 5#55 out of 100 | Save and display | ok |
| 5#55 | 1 | # | 5#55 out of 100 | Save and display | ok |

0 comments on commit 93e30fb

Please sign in to comment.