mirror of
https://github.com/moodle/moodle.git
synced 2025-03-18 22:50:19 +01:00
Merge branch 'MDL-42189-401' of https://github.com/davewoloszyn/moodle into MOODLE_401_STABLE
This commit is contained in:
commit
06ebac56c6
@ -80,14 +80,17 @@ class grade_report_overview extends grade_report {
|
||||
* @param string $context
|
||||
*/
|
||||
public function __construct($userid, $gpr, $context) {
|
||||
global $CFG, $COURSE, $DB;
|
||||
global $CFG, $COURSE, $DB, $USER;
|
||||
parent::__construct($COURSE->id, $gpr, $context);
|
||||
|
||||
// Get the user (for full name).
|
||||
$this->user = $DB->get_record('user', array('id' => $userid));
|
||||
|
||||
// Set onlyactive flag to true if the user's viewing his/her report.
|
||||
$onlyactive = ($this->user->id === $USER->id);
|
||||
|
||||
// Load the user's courses.
|
||||
$this->courses = enrol_get_users_courses($this->user->id, false, 'id, shortname, showgrades');
|
||||
$this->courses = enrol_get_users_courses($this->user->id, $onlyactive, 'id, shortname, showgrades');
|
||||
|
||||
$this->showrank = array();
|
||||
$this->showrank['any'] = false;
|
||||
|
31
grade/report/overview/tests/behat/suspended.feature
Normal file
31
grade/report/overview/tests/behat/suspended.feature
Normal file
@ -0,0 +1,31 @@
|
||||
@gradereport @gradereport_overview
|
||||
Feature: Grade overview report should be hidden from suspended enrolments
|
||||
While viewing the grade overview report
|
||||
As a student
|
||||
I should only see courses I am active in
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Active course | C1 |
|
||||
| Suspended course | C2 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role | status |
|
||||
| student1 | C1 | student | 0 |
|
||||
| student1 | C2 | student | 1 |
|
||||
|
||||
Scenario: Students should not see grades for courses with suspended enrolments
|
||||
Given I am on the "Active course" "grades > Overview report > View" page logged in as "student1"
|
||||
Then I should not see "Suspended course" in the "overview-grade" "table"
|
||||
And I should see "Active course" in the "overview-grade" "table"
|
||||
|
||||
Scenario: Admins should see courses with suspended enrolments
|
||||
Given I log in as "admin"
|
||||
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
||||
And I follow "Student 1"
|
||||
When I click on "Grades overview" "link"
|
||||
Then I should see "Suspended course" in the "overview-grade" "table"
|
||||
And I should see "Active course" in the "overview-grade" "table"
|
Loading…
x
Reference in New Issue
Block a user