Skip to content

Commit

Permalink
Merge branch 'MDL-51905-master' of git://github.com/xow/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Oct 27, 2015
2 parents 53759a0 + 161ffc5 commit 10a8d04
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 17 deletions.
2 changes: 1 addition & 1 deletion blocks/activity_results/block_activity_results.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function get_owning_activity() {
return $result;
}
// See if it is a gradable activity.
if (($rec->gradetype != GRADE_TYPE_VALUE) || ($rec->gradetype != GRADE_TYPE_SCALE)) {
if (($rec->gradetype != GRADE_TYPE_VALUE) && ($rec->gradetype != GRADE_TYPE_SCALE)) {
return $result;
}
return $rec;
Expand Down
66 changes: 50 additions & 16 deletions blocks/activity_results/tests/behat/addblockinactivity.feature
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,44 @@ Feature: The activity results block displays student scores
And I follow "Course 1"
And I turn editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment |
| Assignment name | Test assignment 1 |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
And I follow "Course 1"
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment 2 |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
And I follow "Course 1"
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment 3 |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
And I follow "Course 1"
And I add a "Page" to section "1"
And I set the following fields to these values:
| Name | Test page name |
| Description | Test page description |
| Page content | This is a page |
And I press "Save and return to course"
And I follow "Course 1"
And I should see "Test page name"
And I navigate to "Grades" node in "Course administration"
And I turn editing mode on
And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment"
And I give the grade "80.00" to the user "Student 2" for the grade item "Test assignment"
And I give the grade "70.00" to the user "Student 3" for the grade item "Test assignment"
And I give the grade "60.00" to the user "Student 4" for the grade item "Test assignment"
And I give the grade "50.00" to the user "Student 5" for the grade item "Test assignment"
And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment 1"
And I give the grade "80.00" to the user "Student 2" for the grade item "Test assignment 1"
And I give the grade "70.00" to the user "Student 3" for the grade item "Test assignment 1"
And I give the grade "60.00" to the user "Student 4" for the grade item "Test assignment 1"
And I give the grade "50.00" to the user "Student 5" for the grade item "Test assignment 1"
And I press "Save changes"
And I follow "Course 1"

Scenario: Configure the block on a non-graded activity to show 3 high scores
Given I add a "Page" to section "1"
And I set the following fields to these values:
| Name | Test page name |
| Description | Test page description |
| page | This is a page |
And I press "Save and display"
When I add the "Activity results" block
And I configure the "Activity results" block
Given I follow "Test page name"
And I add the "Activity results" block
When I configure the "Activity results" block
And I set the following fields to these values:
| id_config_activitygradeitemid | Test assignment |
| id_config_activitygradeitemid | Test assignment 1 |
| id_config_showbest | 3 |
| id_config_showworst | 0 |
| id_config_gradeformat | Absolute numbers |
Expand All @@ -63,4 +76,25 @@ Scenario: Configure the block on a non-graded activity to show 3 high scores
And I should see "Student 2" in the "Activity results" "block"
And I should see "80.00" in the "Activity results" "block"
And I should see "Student 3" in the "Activity results" "block"
And I should see "70.00" in the "Activity results" "block"
And I should see "70.00" in the "Activity results" "block"

Scenario: Block should select current activity by default
Given I follow "Test assignment 1"
When I add the "Activity results" block
And I configure the "Activity results" block
Then the field "id_config_activitygradeitemid" matches value "Test assignment 1"
And I follow "Course 1"
And I follow "Test assignment 2"
And I add the "Activity results" block
And I configure the "Activity results" block
And the field "id_config_activitygradeitemid" matches value "Test assignment 2"
And I follow "Course 1"
And I follow "Test assignment 3"
And I add the "Activity results" block
And I configure the "Activity results" block
And the field "id_config_activitygradeitemid" matches value "Test assignment 3"
And I follow "Course 1"
And I follow "Test page name"
And I add the "Activity results" block
And I configure the "Activity results" block
And the field "id_config_activitygradeitemid" does not match value "Test page name"

0 comments on commit 10a8d04

Please sign in to comment.