mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-51905 block_activity_results: Default to the current activity
Due to an incorrect condition, the activity results block would incorrectly identify some blocks as not being gradeable. This meant that edit form could not determine what activity the block was added to. This commit fixes the condition, allowing the current block to be determined correctly
This commit is contained in:
parent
9382ac38d6
commit
161ffc5605
@ -92,7 +92,7 @@ class block_activity_results extends block_base {
|
||||
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;
|
||||
|
@ -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"
|
||||
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:
|
||||
| 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
|
||||
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 |
|
||||
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user