MDL-36877 mod_lesson: Fix while MDL-38578 is not solved

This commit is contained in:
Jean-Michel Vedrine
2015-01-28 21:25:55 +01:00
parent cbc028dbae
commit fc0613cb0c
2 changed files with 21 additions and 6 deletions
@@ -19,10 +19,6 @@ Feature: link to gradebook on the end of lesson page
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 |
@@ -53,6 +49,9 @@ Feature: link to gradebook on the end of lesson page
And I press "Next page"
Then I should see "Congratulations - end of lesson reached"
And I should see "View grades"
And I follow "View grades"
And I should see "User report - Student 1"
And I should see "Test lesson"
@javascript
Scenario: No link to gradebook for non graded lesson
@@ -86,6 +85,22 @@ Feature: link to gradebook on the end of lesson page
Then I should see "Congratulations - end of lesson reached"
And I should not see "View grades"
@javascript
Scenario: No link if Show gradebook to student disabled
Given I follow "Course 1"
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 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
@@ -100,4 +115,4 @@ Feature: link to gradebook on the end of lesson page
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"
And I should not see "View grades"
+1 -1
View File
@@ -569,7 +569,7 @@ if ($pageid != LESSON_EOL) {
$lessoncontent .= html_writer::link($url, get_string('returnto', 'lesson', format_string($course->fullname, true)), array('class'=>'centerpadded lessonbutton standardbutton'));
if (has_capability('gradereport/user:view', context_course::instance($course->id))
&& $lesson->grade != 0 && !$lesson->practice) {
&& $course->showgrades && $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'));