/// Actual Grade
$gradeval = $grade_grade->finalgrade;
- $hint = $grade_grade->get_aggregation_hint($grade_object);
+ $hint = $grade_grade->get_aggregation_hint();
if (!$this->canviewhidden) {
/// Virtual Grade (may be calculated excluding hidden items etc).
$adjustedgrade = $this->blank_hidden_total_and_adjust_bounds($this->courseid,
$notexisting = array_diff(array_keys($items), array_keys($existingitems));
foreach ($notexisting as $itemid) {
- $gradeitem = $this->grade_item;
+ $gradeitem = $items[$itemid];
$gradegrade = new grade_grade(array('itemid' => $itemid,
'userid' => $userid,
'rawgrademin' => $gradeitem->grademin,
/**
* Returns the info on how this value was used in the aggregated grade
*
- * @return string One of 'dropped', 'excluded', 'novalue' or a specific weighting
+ * @return string One of 'dropped', 'excluded', 'novalue', 'used' or 'extra'
*/
public function get_aggregationstatus() {
return $this->aggregationstatus;
if ($grade_grades[$itemid]->is_excluded()) {
unset($values[$itemid]);
$alteredaggregationstatus[$itemid] = 'excluded';
- $alteredaggregationweight[$itemid] = 0;
+ $alteredaggregationweight[$itemid] = null;
continue;
}
// The grade min/max may have been altered by hiding.
if (is_null($value)) {
unset($values[$itemid]);
$alteredaggregationstatus[$itemid] = 'novalue';
- $alteredaggregationweight[$itemid] = 0;
+ $alteredaggregationweight[$itemid] = null;
}
}
} else {
$moredropped = array_diff($allvalues, $values);
foreach ($moredropped as $drop => $unused) {
$alteredaggregationstatus[$drop] = 'dropped';
- $alteredaggregationweight[$drop] = 0;
+ $alteredaggregationweight[$drop] = null;
}
foreach ($values as $itemid => $val) {
* for the grade_category. For example this could be an extra credit item, and it could be
* dropped because it's in the X lowest or highest.
*
- * @param grade_item $gradeitem An optional grade_item, saves having to load the grade_grade's grade_item
* @return array(status, weight) - A keyword and a numerical weight that represents how this grade was included in the aggregation.
*/
- function get_aggregation_hint($gradeitem = null) {
-
+ function get_aggregation_hint() {
return array('status' => $this->get_aggregationstatus(),
- 'weight' => $this->aggregationweight);
+ 'weight' => $this->get_aggregationweight());
}
}