Skip to content

Commit

Permalink
Merge branch 'MDL-67424-master' of git://github.com/rezaies/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
abgreeve committed Jan 22, 2020
2 parents f401150 + ff25eb0 commit dbeca9f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
12 changes: 10 additions & 2 deletions mod/forum/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
14 changes: 14 additions & 0 deletions report/outline/tests/behat/user.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit dbeca9f

Please sign in to comment.