MDL-52954 assign: Fixes to webservices and context.

This patch gets the behat tests passing again - but only with MDL-53772 in the branch.
This commit is contained in:
Damyon Wiese 2016-04-13 14:27:23 +08:00
parent 27cec47220
commit 5267d632ff
3 changed files with 12 additions and 20 deletions

View File

@ -1,4 +1,4 @@
@mod @mod_assign @bug
@mod @mod_assign @javascript
Feature: Check that the assignment grade can be rescaled when the max grade is changed
In order to ensure that the percentages are not affected by changes to the max grade
As a teacher
@ -27,17 +27,20 @@ Feature: Check that the assignment grade can be rescaled when the max grade is c
| Description | Test assignment description |
And I follow "Test assignment name"
And I follow "View all submissions"
And I click on "Grade Student 1" "link" in the "Student 1" "table_row"
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "Grade out of 100" to "40"
And I press "Save changes"
And I press "Continue"
And I press "Ok"
And I click on "Edit settings" "link"
And I follow "Test assignment name"
And I follow "View all submissions"
And "Student 1" row "Grade" column of "generaltable" table should contain "40.00"
Scenario: Update the max grade for an assignment without rescaling existing grades
Given I follow "Edit settings"
And I expand all fieldsets
And I set the field "Maximum grade" to "80"
And I set the field "Rescale existing grades" to "No"
And I set the field "Maximum grade" to "80"
When I press "Save and display"
And I follow "View all submissions"
Then "Student 1" row "Grade" column of "generaltable" table should contain "40.00"
@ -45,22 +48,8 @@ Feature: Check that the assignment grade can be rescaled when the max grade is c
Scenario: Update the max grade for an assignment rescaling existing grades
Given I follow "Edit settings"
And I expand all fieldsets
And I set the field "Maximum grade" to "50"
And I set the field "Rescale existing grades" to "Yes"
And I set the field "Maximum grade" to "50"
When I press "Save and display"
And I follow "View all submissions"
Then "Student 1" row "Grade" column of "generaltable" table should contain "20.00"
Scenario: A rescale existing grades is not needed when keeping max grade unchanged
Given I follow "Edit settings"
And I expand all fieldsets
And I set the field "Maximum grade" to "100"
When I press "Save and display"
Then I should not see "You must choose whether to rescale existing grades or not."
Scenario: A rescale existing grades must be selected when max grade changes
Given I follow "Edit settings"
And I expand all fieldsets
And I set the field "Maximum grade" to "50"
When I press "Save and display"
Then I should see "You must choose whether to rescale existing grades or not."

View File

@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'mod_assign'; // Full name of the plugin (used for diagnostics).
$plugin->version = 2015111603; // The current module version (Date: YYYYMMDDXX).
$plugin->version = 2016041300; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2015111000; // Requires this Moodle version.
$plugin->cron = 60;

View File

@ -536,6 +536,9 @@ class core_user_external extends external_api {
// Retrieve the users.
$users = $DB->get_records_list('user', $field, $cleanedvalues, 'id');
$context = context_system::instance();
self::validate_context($context);
// Finally retrieve each users information.
$returnedusers = array();
foreach ($users as $user) {