From 1d9eb4709d3f6c4056aa4e1a407e551726eff0b2 Mon Sep 17 00:00:00 2001 From: Jinu Abraham Date: Mon, 31 Aug 2015 14:48:31 +0930 Subject: [PATCH 1/2] MDL-50483 gradereport_user: fix the fatal error of no enrolled users --- grade/report/user/index.php | 6 +++++- .../user/tests/behat/view_usereport.feature | 20 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 grade/report/user/tests/behat/view_usereport.feature diff --git a/grade/report/user/index.php b/grade/report/user/index.php index 3136c562a39..b1023e9fdee 100644 --- a/grade/report/user/index.php +++ b/grade/report/user/index.php @@ -167,6 +167,10 @@ if (has_capability('moodle/grade:viewall', $context)) { //Teachers will see all } // Trigger report viewed event. -$report->viewed(); +if (isset($report)) { + $report->viewed(); +} else { + echo $OUTPUT->notification(get_string('nostudentsyet')); +} echo $OUTPUT->footer(); diff --git a/grade/report/user/tests/behat/view_usereport.feature b/grade/report/user/tests/behat/view_usereport.feature new file mode 100644 index 00000000000..b9c7d11cae2 --- /dev/null +++ b/grade/report/user/tests/behat/view_usereport.feature @@ -0,0 +1,20 @@ +@core @core_grades @gradereport_user +Feature: We can use the user report + As a user + I browse to the User report + + Background: + Given the following "courses" exist: + | fullname | shortname | category | + | Course 1 | C1 | 0 | + + Scenario: Verify we can view a user grade report with no users enrolled. + Given I log in as "admin" + And I am on site homepage + And I follow "Course 1" + And I navigate to "Grades" node in "Course administration" + And I select "User report" from the "Grade report" singleselect + And I press "Go" + And I select "All users (0)" from the "Select all or one user" singleselect + And I click on "Go" "button" in the "#choosegradeuser" "css_element" + Then I should see "No students enrolled in this course yet" From a0b2d4e707f59123fe5a5ad2c0c18118dfbff41e Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Fri, 16 Oct 2015 14:28:38 +0800 Subject: [PATCH 2/2] MDL-50483 gradereport_user: fix overlapping on the error message --- grade/report/user/index.php | 3 ++- grade/report/user/styles.css | 1 + .../user/tests/behat/view_usereport.feature | 18 +++++++++--------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/grade/report/user/index.php b/grade/report/user/index.php index b1023e9fdee..149879c328b 100644 --- a/grade/report/user/index.php +++ b/grade/report/user/index.php @@ -166,10 +166,11 @@ if (has_capability('moodle/grade:viewall', $context)) { //Teachers will see all } } -// Trigger report viewed event. if (isset($report)) { + // Trigger report viewed event. $report->viewed(); } else { + echo html_writer::tag('div', '', array('class' => 'clearfix')); echo $OUTPUT->notification(get_string('nostudentsyet')); } diff --git a/grade/report/user/styles.css b/grade/report/user/styles.css index 76959953889..64ee46ae8cb 100644 --- a/grade/report/user/styles.css +++ b/grade/report/user/styles.css @@ -1,5 +1,6 @@ .path-grade-report-user #graded_users_selector { float: right; + margin-bottom: 5px; } .path-grade-report-user #graded_users_selector .singleselect label { display: inline-block; diff --git a/grade/report/user/tests/behat/view_usereport.feature b/grade/report/user/tests/behat/view_usereport.feature index b9c7d11cae2..b4051b86d58 100644 --- a/grade/report/user/tests/behat/view_usereport.feature +++ b/grade/report/user/tests/behat/view_usereport.feature @@ -9,12 +9,12 @@ Feature: We can use the user report | Course 1 | C1 | 0 | Scenario: Verify we can view a user grade report with no users enrolled. - Given I log in as "admin" - And I am on site homepage - And I follow "Course 1" - And I navigate to "Grades" node in "Course administration" - And I select "User report" from the "Grade report" singleselect - And I press "Go" - And I select "All users (0)" from the "Select all or one user" singleselect - And I click on "Go" "button" in the "#choosegradeuser" "css_element" - Then I should see "No students enrolled in this course yet" + Given I log in as "admin" + And I am on site homepage + And I follow "Course 1" + And I navigate to "Grades" node in "Course administration" + And I select "User report" from the "Grade report" singleselect + And I press "Go" + And I select "All users (0)" from the "Select all or one user" singleselect + And I click on "Go" "button" in the "#choosegradeuser" "css_element" + Then I should see "No students enrolled in this course yet"