mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-71181 Quiz: Pass grade not displayed on front page
This commit is contained in:
parent
fc335f5ea0
commit
e10428aa00
@ -407,6 +407,7 @@ $string['gradesdeleted'] = 'Quiz grades deleted';
|
||||
$string['gradesofar'] = '{$a->method}: {$a->mygrade} / {$a->quizgrade}.';
|
||||
$string['gradetopassnotset'] = 'This quiz does not yet have a grade to pass set. It may be set in the Grade section of the quiz settings.';
|
||||
$string['gradetopassmustbeset'] = 'Grade to pass cannot be zero as this quiz has its completion method set to require passing grade. Please set a non-zero value.';
|
||||
$string['gradetopassoutof'] = 'Grade to pass: {$a->grade} out of {$a->maxgrade}';
|
||||
$string['gradingdetails'] = 'Marks for this submission: {$a->raw}/{$a->max}.';
|
||||
$string['gradingdetailsadjustment'] = 'With previous penalties this gives <strong>{$a->cur}/{$a->max}</strong>.';
|
||||
$string['gradingdetailspenalty'] = 'This submission attracted a penalty of {$a}.';
|
||||
|
32
mod/quiz/tests/behat/info_page.feature
Normal file
32
mod/quiz/tests/behat/info_page.feature
Normal file
@ -0,0 +1,32 @@
|
||||
@mod @mod_quiz
|
||||
Feature: Display of information before starting a quiz
|
||||
As a student
|
||||
In order to start a quiz with confidence
|
||||
I need information about the quiz settings before I start an attempt
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student | Student | One | student@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student | C1 | student |
|
||||
And the following "question categories" exist:
|
||||
| contextlevel | reference | name |
|
||||
| Course | C1 | Test questions |
|
||||
And the following "questions" exist:
|
||||
| questioncategory | qtype | name | questiontext |
|
||||
| Test questions | truefalse | TF1 | Text of the first question |
|
||||
|
||||
Scenario: Check the pass grade is displayed
|
||||
Given the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber | gradepass |
|
||||
| quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | 60.00 |
|
||||
And quiz "Quiz 1" contains the following questions:
|
||||
| question | page |
|
||||
| TF1 | 1 |
|
||||
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
||||
Then I should see "Grade to pass: 60.00 out of 100.00"
|
@ -122,6 +122,8 @@ if (!$canpreview) {
|
||||
$mygradeoverridden = false;
|
||||
$gradebookfeedback = '';
|
||||
|
||||
$item = null;
|
||||
|
||||
$grading_info = grade_get_grades($course->id, 'mod', 'quiz', $quiz->id, $USER->id);
|
||||
if (!empty($grading_info->items)) {
|
||||
$item = $grading_info->items[0];
|
||||
@ -185,6 +187,13 @@ if ($quiz->attempts != 1) {
|
||||
quiz_get_grading_option_name($quiz->grademethod));
|
||||
}
|
||||
|
||||
if ($item && $item->gradepass) {
|
||||
$a = new stdClass();
|
||||
$a->grade = quiz_format_grade($quiz, $item->gradepass);
|
||||
$a->maxgrade = quiz_format_grade($quiz, $quiz->grade);
|
||||
$viewobj->infomessages[] = get_string('gradetopassoutof', 'quiz', $a);
|
||||
}
|
||||
|
||||
// Determine wheter a start attempt button should be displayed.
|
||||
$viewobj->quizhasquestions = $quizobj->has_questions();
|
||||
$viewobj->preventmessages = array();
|
||||
|
Loading…
x
Reference in New Issue
Block a user