mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
Merge branch 'MDL-49573-master' of git://github.com/gurgus/moodle
This commit is contained in:
commit
9697b3da0a
@ -343,8 +343,12 @@ class grade extends tablelike implements selectable_items, filterable_items {
|
||||
}
|
||||
|
||||
foreach ($data as $varname => $value) {
|
||||
if (preg_match('/override_(\d+)_(\d+)/', $varname, $matches)) {
|
||||
$data->$matches[0] = '1';
|
||||
if (preg_match('/^oldoverride_(\d+)_(\d+)/', $varname, $matches)) {
|
||||
// If we've selected override or overriding all grades.
|
||||
if (!empty($data->$matches[0]) || $filter == 'all') {
|
||||
$override = "override_{$matches[1]}_{$matches[2]}";
|
||||
$data->$override = '1';
|
||||
}
|
||||
}
|
||||
if (!preg_match('/^finalgrade_(\d+)_/', $varname, $matches)) {
|
||||
continue;
|
||||
|
@ -352,6 +352,10 @@ class user extends tablelike implements selectable_items {
|
||||
continue;
|
||||
}
|
||||
|
||||
$oldfinalgradefield = "oldfinalgrade_{$gradeitem->id}_{$this->itemid}";
|
||||
if (!empty($data->$oldfinalgradefield)) {
|
||||
continue;
|
||||
}
|
||||
$grade = grade_grade::fetch(array(
|
||||
'itemid' => $this->itemid,
|
||||
'userid' => $userid
|
||||
@ -369,8 +373,12 @@ class user extends tablelike implements selectable_items {
|
||||
}
|
||||
|
||||
foreach ($data as $varname => $value) {
|
||||
if (preg_match('/override_(\d+)_(\d+)/', $varname, $matches)) {
|
||||
$data->$matches[0] = '1';
|
||||
if (preg_match('/^oldoverride_(\d+)_(\d+)/', $varname, $matches)) {
|
||||
// If we've selected override or overriding all grades.
|
||||
if (!empty($data->$matches[0]) || $filter == 'all') {
|
||||
$override = "override_{$matches[1]}_{$matches[2]}";
|
||||
$data->$override = '1';
|
||||
}
|
||||
}
|
||||
if (!preg_match('/^finalgrade_(\d+)_(\d+)/', $varname, $matches)) {
|
||||
continue;
|
||||
|
101
grade/report/singleview/tests/behat/bulk_insert_grades.feature
Normal file
101
grade/report/singleview/tests/behat/bulk_insert_grades.feature
Normal file
@ -0,0 +1,101 @@
|
||||
@core @core_grades @gradereport_singleview
|
||||
Feature: We can bulk insert grades for students in a course
|
||||
As a teacher
|
||||
In order to quickly grade items
|
||||
I can bulk insert values for all or empty grades.
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email | idnumber | alternatename |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com | t1 | fred |
|
||||
| student1 | Student | 1 | student1@asd.com | s1 | james |
|
||||
| student2 | Student | 2 | student1@asd.com | s2 | holly |
|
||||
| student3 | Student | 3 | student1@asd.com | s3 | anna |
|
||||
| student4 | Student | 4 | student1@asd.com | s4 | zac |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
| student2 | C1 | student |
|
||||
| student3 | C1 | student |
|
||||
| student4 | C1 | student |
|
||||
And the following "activities" exist:
|
||||
| activity | course | idnumber | name | intro |
|
||||
| assign | C1 | a1 | Test assignment one | Submit something! |
|
||||
| assign | C1 | a2 | Test assignment two | Submit something! |
|
||||
| assign | C1 | a3 | Test assignment three | Submit something! |
|
||||
| assign | C1 | a4 | Test assignment four | Submit nothing! |
|
||||
|
||||
@javascript
|
||||
Scenario: I can bulk insert grades and check their override flags for grade view.
|
||||
Given I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I follow "Test assignment one"
|
||||
And I follow "View/grade all submissions"
|
||||
And I follow "Grade Student 1"
|
||||
And I set the following fields to these values:
|
||||
| Grade out of 100 | 50 |
|
||||
And I press "Save changes"
|
||||
And I press "Continue"
|
||||
And I follow "View gradebook"
|
||||
And I follow "Single view for Test assignment one"
|
||||
Then the field "Grade for james (Student) 1" matches value "50.00"
|
||||
And the field "Override for james (Student) 1" matches value "0"
|
||||
And I click on "Perform bulk insert" "checkbox"
|
||||
And I set the field "Insert value" to "1.0"
|
||||
And I press "Save"
|
||||
And I press "Continue"
|
||||
And the field "Grade for james (Student) 1" matches value "50.00"
|
||||
And the field "Override for james (Student) 1" matches value "0"
|
||||
And the field "Grade for holly (Student) 2" matches value "1.00"
|
||||
And the field "Override for holly (Student) 2" matches value "1"
|
||||
And the field "Grade for anna (Student) 3" matches value "1.00"
|
||||
And the field "Override for anna (Student) 3" matches value "1"
|
||||
And the field "Grade for zac (Student) 4" matches value "1.00"
|
||||
And the field "Override for zac (Student) 4" matches value "1"
|
||||
And I click on "All grades" "option"
|
||||
And I click on "Perform bulk insert" "checkbox"
|
||||
And I set the field "Insert value" to "2.0"
|
||||
And I press "Save"
|
||||
And I press "Continue"
|
||||
And the field "Grade for james (Student) 1" matches value "2.00"
|
||||
And the field "Override for james (Student) 1" matches value "1"
|
||||
And the field "Grade for holly (Student) 2" matches value "2.00"
|
||||
And the field "Override for holly (Student) 2" matches value "1"
|
||||
And the field "Grade for anna (Student) 3" matches value "2.00"
|
||||
And the field "Override for anna (Student) 3" matches value "1"
|
||||
And the field "Grade for zac (Student) 4" matches value "2.00"
|
||||
And the field "Override for zac (Student) 4" matches value "1"
|
||||
|
||||
@javascript
|
||||
Scenario: I can bulk insert grades and check their override flags for user view.
|
||||
Given I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I follow "Test assignment two"
|
||||
And I follow "View/grade all submissions"
|
||||
And I follow "Grade Student 1"
|
||||
And I set the following fields to these values:
|
||||
| Grade out of 100 | 50 |
|
||||
And I press "Save changes"
|
||||
And I press "Continue"
|
||||
And I follow "View gradebook"
|
||||
And I follow "Single view for Test assignment two"
|
||||
And I click on "Student 1" "option"
|
||||
Then the field "Grade for Test assignment two" matches value "50.00"
|
||||
And the field "Override for Test assignment two" matches value "0"
|
||||
And I click on "Perform bulk insert" "checkbox"
|
||||
And I click on "Empty grades" "option"
|
||||
And I set the field "Insert value" to "1.0"
|
||||
And I press "Save"
|
||||
And I press "Continue"
|
||||
And the field "Grade for Test assignment two" matches value "50.00"
|
||||
And the field "Override for Test assignment two" matches value "0"
|
||||
And the field "Grade for Test assignment one" matches value "1.00"
|
||||
And the field "Override for Test assignment one" matches value "1"
|
||||
And the field "Grade for Test assignment three" matches value "1.00"
|
||||
And the field "Override for Test assignment three" matches value "1"
|
||||
And the field "Grade for Test assignment four" matches value "1.00"
|
||||
And the field "Override for Test assignment four" matches value "1"
|
Loading…
x
Reference in New Issue
Block a user