MDL-36877 Lesson: final page not displayed if show gradebook set to no
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
@mod @mod_lesson
|
||||
Feature: link to gradebook on the end of lesson page
|
||||
In order to allow students to see their lesson grades
|
||||
As a teacher
|
||||
I need to provide a link to gradebook on the end of lesson page
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
And I click on "Edit settings" "link" in the "Administration" "block"
|
||||
And I set the following fields to these values:
|
||||
| Show gradebook to students | No |
|
||||
And I press "Save changes"
|
||||
And I add a "Lesson" to section "1" and I fill the form with:
|
||||
| Name | Test lesson |
|
||||
| Description | Test lesson description |
|
||||
And I follow "Test lesson"
|
||||
And I follow "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | First page name |
|
||||
| Page contents | First page contents |
|
||||
| id_answer_editor_0 | Next page |
|
||||
| id_jumpto_0 | Next page |
|
||||
And I press "Save page"
|
||||
And I set the field "qtype" to "Add a content page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Second page name |
|
||||
| Page contents | Second page contents |
|
||||
| id_answer_editor_0 | Previous page |
|
||||
| id_jumpto_0 | Previous page |
|
||||
| id_answer_editor_1 | Next page |
|
||||
| id_jumpto_1 | Next page |
|
||||
And I press "Save page"
|
||||
@javascript
|
||||
Scenario: Link to gradebook for non practice lesson
|
||||
Given I log out
|
||||
When I log in as "student1"
|
||||
And I follow "Course 1"
|
||||
And I follow "Test lesson"
|
||||
And I press "Next page"
|
||||
And I press "Next page"
|
||||
Then I should see "Congratulations - end of lesson reached"
|
||||
And I should see "View grades"
|
||||
|
||||
@javascript
|
||||
Scenario: No link to gradebook for non graded lesson
|
||||
Given I follow "Test lesson"
|
||||
And I navigate to "Edit settings" node in "Lesson administration"
|
||||
And I set the following fields to these values:
|
||||
| Type | None |
|
||||
And I press "Save and display"
|
||||
And I log out
|
||||
When I log in as "student1"
|
||||
And I follow "Course 1"
|
||||
And I follow "Test lesson"
|
||||
And I press "Next page"
|
||||
And I press "Next page"
|
||||
Then I should see "Congratulations - end of lesson reached"
|
||||
And I should not see "View grades"
|
||||
|
||||
@javascript
|
||||
Scenario: No link to gradebook for practice lesson
|
||||
Given I follow "Test lesson"
|
||||
And I navigate to "Edit settings" node in "Lesson administration"
|
||||
And I set the following fields to these values:
|
||||
| Practice lesson | Yes |
|
||||
And I press "Save and display"
|
||||
And I log out
|
||||
When I log in as "student1"
|
||||
And I follow "Course 1"
|
||||
And I follow "Test lesson"
|
||||
And I press "Next page"
|
||||
And I press "Next page"
|
||||
Then I should see "Congratulations - end of lesson reached"
|
||||
And I should not see "View grades"
|
||||
|
||||
@javascript
|
||||
Scenario: No link to gradebook if no gradereport/user:view capability
|
||||
Given I log out
|
||||
And I log in as "admin"
|
||||
And I set the following system permissions of "Student" role:
|
||||
| capability | permission |
|
||||
| gradereport/user:view | Prevent |
|
||||
And I log out
|
||||
When I log in as "student1"
|
||||
And I follow "Course 1"
|
||||
And I follow "Test lesson"
|
||||
And I press "Next page"
|
||||
And I press "Next page"
|
||||
Then I should see "Congratulations - end of lesson reached"
|
||||
And I should not see "View grades"
|
||||
+2
-7
@@ -503,12 +503,6 @@ if ($pageid != LESSON_EOL) {
|
||||
}
|
||||
$lessoncontent .= $OUTPUT->box_end(); //End of Lesson button to Continue.
|
||||
|
||||
// after all the grade processing, check to see if "Show Grades" is off for the course
|
||||
// if yes, redirect to the course page
|
||||
if (!$course->showgrades) {
|
||||
redirect(new moodle_url('/course/view.php', array('id'=>$course->id)));
|
||||
}
|
||||
|
||||
// high scores code
|
||||
if ($lesson->highscores && !$canmanage && !$lesson->practice) {
|
||||
$lessoncontent .= $OUTPUT->box_start('center');
|
||||
@@ -574,7 +568,8 @@ if ($pageid != LESSON_EOL) {
|
||||
$url = new moodle_url('/course/view.php', array('id'=>$course->id));
|
||||
$lessoncontent .= html_writer::link($url, get_string('returnto', 'lesson', format_string($course->fullname, true)), array('class'=>'centerpadded lessonbutton standardbutton'));
|
||||
|
||||
if (!$lesson->practice) {
|
||||
if (has_capability('gradereport/user:view', context_course::instance($course->id))
|
||||
&& $lesson->grade != 0 && !$lesson->practice) {
|
||||
$url = new moodle_url('/grade/index.php', array('id' => $course->id));
|
||||
$lessoncontent .= html_writer::link($url, get_string('viewgrades', 'lesson'),
|
||||
array('class' => 'centerpadded lessonbutton standardbutton'));
|
||||
|
||||
Reference in New Issue
Block a user