Commit 1d8090a7 authored by Andrew Nicols's avatar Andrew Nicols
Browse files

Merge branch 'wip-MDL-51552-28' of git://github.com/abgreeve/moodle into MOODLE_28_STABLE

parents 318f7454 9323277c
......@@ -325,19 +325,13 @@ class grade extends tablelike implements selectable_items, filterable_items {
$data->$field = empty($grade) ? $null : $grade->finalgrade;
$data->{"old$field"} = $data->$field;
preg_match('/_(\d+)_(\d+)/', $field, $oldoverride);
$oldoverride = 'oldoverride' . $oldoverride[0];
if (empty($data->$oldoverride)) {
$data->$field = (!isset($grade->rawgrade)) ? $null : $grade->rawgrade;
}
}
}
foreach ($data as $varname => $value) {
if (preg_match('/^oldoverride_(\d+)_(\d+)/', $varname, $matches)) {
// If we've selected override or overriding all grades.
if (!empty($data->$matches[0]) || $filter == 'all') {
// If we've selected overriding all grades.
if ($filter == 'all') {
$override = "override_{$matches[1]}_{$matches[2]}";
$data->$override = '1';
}
......
......@@ -334,29 +334,32 @@ class user extends tablelike implements selectable_items {
}
$oldfinalgradefield = "oldfinalgrade_{$gradeitem->id}_{$this->itemid}";
if (!empty($data->$oldfinalgradefield)) {
// Bulk grade changes for all grades need to be processed and shouldn't be skipped if they had a previous grade.
if ($gradeitem->is_course_item() || ($filter != 'all' && !empty($data->$oldfinalgradefield))) {
if ($gradeitem->is_course_item()) {
// The course total should not be overridden.
unset($data->$field);
unset($data->oldfinalgradefield);
$oldoverride = "oldoverride_{$gradeitem->id}_{$this->itemid}";
unset($data->$oldoverride);
$oldfeedback = "oldfeedback_{$gradeitem->id}_{$this->itemid}";
unset($data->$oldfeedback);
}
continue;
}
$grade = grade_grade::fetch(array(
'itemid' => $this->itemid,
'itemid' => $gradeitemid,
'userid' => $userid
));
$data->$field = empty($grade) ? $null : $grade->finalgrade;
$data->{"old$field"} = $data->$field;
preg_match('/_(\d+)_(\d+)/', $field, $oldoverride);
$oldoverride = 'oldoverride' . $oldoverride[0];
if (empty($data->$oldoverride)) {
$data->$field = (!isset($grade->rawgrade)) ? $null : $grade->rawgrade;
}
}
foreach ($data as $varname => $value) {
if (preg_match('/^oldoverride_(\d+)_(\d+)/', $varname, $matches)) {
// If we've selected override or overriding all grades.
if (!empty($data->$matches[0]) || $filter == 'all') {
// If we've selected overriding all grades.
if ($filter == 'all') {
$override = "override_{$matches[1]}_{$matches[2]}";
$data->$override = '1';
}
......
......@@ -47,14 +47,7 @@ class finalgrade extends grade_attribute_format implements unique_value, be_disa
public function get_value() {
$this->label = $this->grade->grade_item->itemname;
$isoverridden = $this->grade->is_overridden();
// If the grade is overridden or the grade type is not an activity then use finalgrade.
if (!empty($isoverridden) || $this->grade->grade_item->itemtype != 'mod') {
$val = $this->grade->finalgrade;
} else {
$val = $this->grade->rawgrade;
}
$val = $this->grade->finalgrade;
if ($this->grade->grade_item->scaleid) {
return $val ? (int)$val : -1;
} else {
......
......@@ -105,7 +105,7 @@ Feature: We can use Single view
And I set the field "Insert value" to "1.0"
And I click on "Perform bulk insert" "checkbox"
And I press "Update"
Then I should see "Grades were set for 9 items"
Then I should see "Grades were set for 8 items"
Scenario: Navigation works in the Single view.
Given I follow "Single view for Student 1"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment