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

This commit is contained in:
Jean-Michel Vedrine 2015-01-28 20:54:38 +01:00
parent ccf2a054ae
commit 59d7a9dc75
2 changed files with 21 additions and 5 deletions

View File

@ -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 and display"
And I add a "Lesson" to section "1" and I fill the form with:
| Name | Test lesson |
| Description | Test lesson description |
@ -43,6 +39,7 @@ Feature: link to gradebook on the end of lesson 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
@ -53,6 +50,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 +86,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 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

View File

@ -578,7 +578,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'));