Merge branch 'wip-MDL-59055-32' of git://github.com/marinaglancy/moodle into MOODLE_32_STABLE
This commit is contained in:
@@ -974,7 +974,7 @@ class grade_report_grader extends grade_report {
|
||||
$usergrades = $this->allgrades[$userid];
|
||||
$hidingaffected = grade_grade::get_hiding_affected($usergrades, $allgradeitems);
|
||||
$altered = $hidingaffected['altered'];
|
||||
$unknown = $hidingaffected['unknown'];
|
||||
$unknown = $hidingaffected['unknowngrades'];
|
||||
unset($hidingaffected);
|
||||
}
|
||||
|
||||
@@ -996,7 +996,7 @@ class grade_report_grader extends grade_report {
|
||||
// Get the decimal points preference for this item
|
||||
$decimalpoints = $item->get_decimals();
|
||||
|
||||
if (in_array($itemid, $unknown)) {
|
||||
if (array_key_exists($itemid, $unknown)) {
|
||||
$gradeval = null;
|
||||
} else if (array_key_exists($itemid, $altered)) {
|
||||
$gradeval = $altered[$itemid];
|
||||
|
||||
@@ -525,14 +525,14 @@ abstract class grade_report {
|
||||
$aggregationweight = null;
|
||||
}
|
||||
}
|
||||
} else if (!empty($hiding_affected['unknown'][$course_item->id])) {
|
||||
} else if (array_key_exists($course_item->id, $hiding_affected['unknowngrades'])) {
|
||||
//not sure whether or not this item depends on a hidden item
|
||||
if (!$this->showtotalsifcontainhidden[$courseid]) {
|
||||
//hide the grade
|
||||
$finalgrade = null;
|
||||
} else {
|
||||
//use reprocessed marks that exclude hidden items
|
||||
$finalgrade = $hiding_affected['unknown'][$course_item->id];
|
||||
$finalgrade = $hiding_affected['unknowngrades'][$course_item->id];
|
||||
|
||||
if (array_key_exists($course_item->id, $hiding_affected['alteredgrademin'])) {
|
||||
$grademin = $hiding_affected['alteredgrademin'][$course_item->id];
|
||||
|
||||
@@ -27,6 +27,14 @@ Feature: Student and teacher's view of aggregated grade items is consistent when
|
||||
| assign | C1 | a3 | Test assignment three | Submit something! | Sub category 2 | 100 |
|
||||
| assign | C1 | a4 | Test assignment four | Submit something! | Sub category 2 | 100 |
|
||||
And I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Setup > Gradebook setup" in the course gradebook
|
||||
And I press "Add grade item"
|
||||
And I set the following fields to these values:
|
||||
| Item name | calculated |
|
||||
And I press "Save changes"
|
||||
And I set "=[[a4]]/2" calculation for grade item "calculated" with idnumbers:
|
||||
| Sub category 1 | sub1 |
|
||||
And I navigate to "Overview report" node in "Site administration > Grades > Report settings"
|
||||
And I set the field "s__grade_report_overview_showtotalsifcontainhidden" to "Show totals excluding hidden items"
|
||||
And I navigate to "User report" node in "Site administration > Grades > Report settings"
|
||||
|
||||
@@ -727,8 +727,9 @@ class grade_grade extends grade_object {
|
||||
*
|
||||
* @param array $grade_grades all course grades of one user, & used for better internal caching
|
||||
* @param array $grade_items array of grade items, & used for better internal caching
|
||||
* @return array This is an array of 3 arrays:
|
||||
* unknown => list of item ids that may be affected by hiding (with the calculated grade as the value)
|
||||
* @return array This is an array of following arrays:
|
||||
* unknown => list of item ids that may be affected by hiding (with the ITEM ID as both the key and the value) - for BC with old gradereport plugins
|
||||
* unknowngrades => list of item ids that may be affected by hiding (with the calculated grade as the value)
|
||||
* altered => list of item ids that are definitely affected by hiding (with the calculated grade as the value)
|
||||
* alteredgrademax => for each item in altered or unknown, the new value of the grademax
|
||||
* alteredgrademin => for each item in altered or unknown, the new value of the grademin
|
||||
@@ -779,6 +780,7 @@ class grade_grade extends grade_object {
|
||||
|
||||
if (!$hiddenfound) {
|
||||
return array('unknown' => array(),
|
||||
'unknowngrades' => array(),
|
||||
'altered' => array(),
|
||||
'alteredgrademax' => array(),
|
||||
'alteredgrademin' => array(),
|
||||
@@ -795,10 +797,10 @@ class grade_grade extends grade_object {
|
||||
for($i=0; $i<$max; $i++) {
|
||||
$found = false;
|
||||
foreach($todo as $key=>$do) {
|
||||
$hidden_precursors = array_intersect($dependson[$do], $unknown);
|
||||
$hidden_precursors = array_intersect($dependson[$do], array_keys($unknown));
|
||||
if ($hidden_precursors) {
|
||||
// this item depends on hidden grade indirectly
|
||||
$unknown[$do] = $do;
|
||||
$unknown[$do] = $grade_grades[$do]->finalgrade;
|
||||
unset($todo[$key]);
|
||||
$found = true;
|
||||
continue;
|
||||
@@ -828,7 +830,7 @@ class grade_grade extends grade_object {
|
||||
) {
|
||||
// This is a grade item that is not a category or course and has been affected by grade hiding.
|
||||
// I guess this means it is a calculation that needs to be recalculated.
|
||||
$unknown[$do] = $do;
|
||||
$unknown[$do] = $grade_grades[$do]->finalgrade;
|
||||
unset($todo[$key]);
|
||||
$found = true;
|
||||
continue;
|
||||
@@ -953,7 +955,8 @@ class grade_grade extends grade_object {
|
||||
}
|
||||
}
|
||||
|
||||
return array('unknown' => $unknown,
|
||||
return array('unknown' => array_combine(array_keys($unknown), array_keys($unknown)), // Left for BC in case some gradereport plugins expect it.
|
||||
'unknowngrades' => $unknown,
|
||||
'altered' => $altered,
|
||||
'alteredgrademax' => $alteredgrademax,
|
||||
'alteredgrademin' => $alteredgrademin,
|
||||
|
||||
Reference in New Issue
Block a user