mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merge branch 'master-MDL-48633' of https://github.com/golenkovm/moodle
This commit is contained in:
commit
733419daa9
3 changed files with 50 additions and 8 deletions
|
@ -3504,6 +3504,7 @@ class lesson extends lesson_base {
|
|||
'displayscorewithessays' => false,
|
||||
'displayscorewithoutessays' => false,
|
||||
'yourcurrentgradeisoutof' => false,
|
||||
'yourcurrentgradeis' => false,
|
||||
'eolstudentoutoftimenoanswers' => false,
|
||||
'welldone' => false,
|
||||
'progressbar' => false,
|
||||
|
@ -3594,12 +3595,6 @@ class lesson extends lesson_base {
|
|||
} else {
|
||||
$data->displayscorewithoutessays = $a;
|
||||
}
|
||||
if ($this->properties->grade != GRADE_TYPE_NONE) {
|
||||
$a = new stdClass;
|
||||
$a->grade = format_float($gradeinfo->grade * $this->properties->grade / 100, 1);
|
||||
$a->total = $this->properties->grade;
|
||||
$data->yourcurrentgradeisoutof = $a;
|
||||
}
|
||||
|
||||
$grade = new stdClass();
|
||||
$grade->lessonid = $this->properties->id;
|
||||
|
@ -3617,6 +3612,25 @@ class lesson extends lesson_base {
|
|||
} else {
|
||||
$newgradeid = $DB->insert_record("lesson_grades", $grade);
|
||||
}
|
||||
|
||||
// Update central gradebook.
|
||||
lesson_update_grades($this, $USER->id);
|
||||
|
||||
// Print grade (grade type Point).
|
||||
if ($this->properties->grade > 0) {
|
||||
$a = new stdClass;
|
||||
$a->grade = format_float($gradeinfo->grade * $this->properties->grade / 100, 1);
|
||||
$a->total = $this->properties->grade;
|
||||
$data->yourcurrentgradeisoutof = $a;
|
||||
}
|
||||
|
||||
// Print grade (grade type Scale).
|
||||
if ($this->properties->grade < 0) {
|
||||
// Grade type is Scale.
|
||||
$grades = grade_get_grades($course->id, 'mod', 'lesson', $cm->instance, $USER->id);
|
||||
$grade = reset($grades->items[0]->grades);
|
||||
$data->yourcurrentgradeis = $grade->str_grade;
|
||||
}
|
||||
} else {
|
||||
if ($this->properties->timelimit) {
|
||||
if ($outoftime == 'normal') {
|
||||
|
@ -3627,14 +3641,15 @@ class lesson extends lesson_base {
|
|||
$grade->completed = time();
|
||||
$newgradeid = $DB->insert_record("lesson_grades", $grade);
|
||||
$data->eolstudentoutoftimenoanswers = true;
|
||||
|
||||
// Update central gradebook.
|
||||
lesson_update_grades($this, $USER->id);
|
||||
}
|
||||
} else {
|
||||
$data->welldone = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Update central gradebook.
|
||||
lesson_update_grades($this, $USER->id);
|
||||
$data->progresscompleted = $progresscompleted;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -595,6 +595,9 @@ class mod_lesson_renderer extends plugin_renderer_base {
|
|||
if ($data->yourcurrentgradeisoutof !== false) {
|
||||
$output .= $this->paragraph(get_string("yourcurrentgradeisoutof", "lesson", $data->yourcurrentgradeisoutof), 'center');
|
||||
}
|
||||
if ($data->yourcurrentgradeis !== false) {
|
||||
$output .= $this->paragraph(get_string("yourcurrentgradeis", "lesson", $data->yourcurrentgradeis), 'center');
|
||||
}
|
||||
if ($data->eolstudentoutoftimenoanswers !== false) {
|
||||
$output .= $this->paragraph(get_string("eolstudentoutoftimenoanswers", "lesson"));
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@ Feature: In a lesson activity, if custom scoring is not enabled, student should
|
|||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
And the following "scales" exist:
|
||||
| name | scale |
|
||||
| Test Scale | Disappointing, Good, Excellent |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
|
@ -44,6 +47,14 @@ Feature: In a lesson activity, if custom scoring is not enabled, student should
|
|||
| id_response_editor_1 | Incorrect answer |
|
||||
| id_jumpto_1 | This page |
|
||||
And I press "Save page"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I duplicate "Test lesson name" activity
|
||||
And I wait until section "1" is available
|
||||
And I am on the "Test lesson name (copy)" "lesson activity editing" page
|
||||
And I set the field "Name" to "Test lesson name 2"
|
||||
And I set the field "grade[modgrade_type]" to "Scale"
|
||||
And I set the field "Scale" to "Test Scale"
|
||||
And I press "Save and return to course"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
|
||||
|
@ -83,3 +94,16 @@ Feature: In a lesson activity, if custom scoring is not enabled, student should
|
|||
And I should see "Number of correct answers: 0"
|
||||
And I should see "Your score is 0 (out of 1)."
|
||||
And I should see "Your current grade is 0#0 out of 75"
|
||||
|
||||
Scenario: Current grade is displayed at end of lesson when grade type is set to scale
|
||||
Given I am on "Course 1" course homepage
|
||||
And I follow "Test lesson name 2"
|
||||
When I press "Next page"
|
||||
And I should see "1 + 1?"
|
||||
And I set the following fields to these values:
|
||||
| Your answer | 2 |
|
||||
And I press "Submit"
|
||||
And I press "Continue"
|
||||
Then I should see "Congratulations - end of lesson reached"
|
||||
And I should see "Your score is 1 (out of 1)."
|
||||
And I should see "Your current grade is Excellent"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue