Merge branch 'MDL-67424-master' of git://github.com/rezaies/moodle

This commit is contained in:
Adrian Greeve 2020-01-22 13:56:33 +08:00
commit dbeca9f5ca
2 changed files with 24 additions and 2 deletions

View File

@ -546,8 +546,16 @@ function forum_user_complete($course, $user, $mod, $forum) {
};
$grades = grade_get_grades($course->id, 'mod', 'forum', $forum->id, $user->id);
echo $getgradeinfo($grades->items[0]->grades, 'rating');
echo $getgradeinfo($grades->items[1]->grades, 'wholeforum');
// Item 0 is the rating.
if (!empty($grades->items[0]->grades)) {
echo $getgradeinfo($grades->items[0]->grades, 'rating');
}
// Item 1 is the whole-forum grade.
if (!empty($grades->items[1]->grades)) {
echo $getgradeinfo($grades->items[1]->grades, 'wholeforum');
}
if ($posts = forum_get_user_posts($forum->id, $user->id)) {
if (!$cm = get_coursemodule_from_instance('forum', $forum->id, $course->id)) {

View File

@ -113,3 +113,17 @@ Feature: View the user page for the outline report
When I follow "Complete report"
And I should see "4 views"
And I should see "3 views"
Scenario: View the user complete report page when there is a no-grade forum
Given the following "activities" exist:
| activity | name | description | course | idnumber |
| forum | forum1 | C1 first forum | C1 | forum1 |
And I am on "Course 1" course homepage
When I follow "Participants"
And I follow "Student 1"
And I follow "Outline report"
Then I should see "Outline report"
When I follow "Participants"
And I follow "Student 1"
And I follow "Complete report"
Then I should see "Complete report"