diff -wr moodle-clean/moodle/admin/settings/grades.php moodle-live/admin/settings/grades.php 68a69 > GRADE_AGGREGATE_OUTOF =>get_string('aggregateoutof', 'grades'), diff -wr moodle-clean/moodle/grade/edit/tree/category_form.php moodle-live/grade/edit/tree/category_form.php 41a42 > GRADE_AGGREGATE_OUTOF =>get_string('aggregateoutof', 'grades'), diff -wr moodle-clean/moodle/lang/en_utf8/grades.php moodle-live/lang/en_utf8/grades.php 27a28 > $string['aggregateoutof'] = 'Proportion of work completed'; diff -wr moodle-clean/moodle/lib/grade/constants.php moodle-live/lib/grade/constants.php 44a45 > define('GRADE_AGGREGATE_OUTOF', 14); diff -wr moodle-clean/moodle/lib/grade/grade_category.php moodle-live/lib/grade/grade_category.php 514a515,521 > /// outof is a special aggregation types - it does not use relative values > if ($this->aggregation == GRADE_AGGREGATE_OUTOF) { > $this->outof_grades($grade, $oldfinalgrade, $items, $grade_values, $excluded); > return; > } > > 687a695,707 > > > /** > * internal function for category grades summing > * > * @param object $grade > * @param int $userid > * @param float $oldfinalgrade > * @param array $items > * @param array $grade_values > * @param bool $excluded > * @return boolean (just plain return;) > */ 741a762,824 > > > /** > * internal function for category grades outof calculation > * > * @param object $grade > * @param int $userid > * @param float $oldfinalgrade > * @param array $items > * @param array $grade_values > * @param bool $excluded > * @return boolean (just plain return;) > */ > function outof_grades(&$grade, $oldfinalgrade, $items, $grade_values, $excluded) { > > $completed=0; > > foreach ($items as $item){ > > // ungraded and exluded items are not used in aggregation > if (!array_key_exists($item->id,$grade_values) or is_null($grade_values[$item->id])) { > unset($items[$item->id]); > continue; > } > > > //have they done this piece of work? > if ($item->gradetype == GRADE_TYPE_VALUE and $grade_values[$item->id]>0){ > $completed+=1; > }elseif ($item->gradetype == GRADE_TYPE_SCALE and $grade_values[$item->id]>1){ > $completed+=1; > } > } > > > $max = count($items); > > if ($this->grade_item->grademax != $max or $this->grade_item->grademin != 0 or $this->grade_item->gradetype != GRADE_TYPE_VALUE){ > $this->grade_item->grademax = 1; > $this->grade_item->grademin = 0; > $this->grade_item->gradetype = GRADE_TYPE_VALUE; > $this->grade_item->update('aggregation'); > } > > $this->apply_limit_rules($grade_values); > > if($max==0){ > $outof=0; > }else{ > $outof=$completed / $max; > } > > $grade->finalgrade = $outof; > > // update in db if changed > if (grade_floats_different($grade->finalgrade, $oldfinalgrade)) { > $grade->update('aggregation'); > } > > return; > } > >