Skip to content

Commit

Permalink
MDL-18402 Setting aggregationcoef to 1 if left empty
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasconnault committed Feb 27, 2009
1 parent 61ed6f0 commit 13cd357
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/grade/grade_item.php
Expand Up @@ -247,6 +247,7 @@ class grade_item extends grade_object {
* In addition to update() as defined in grade_object, handle the grade_outcome and grade_scale objects.
* Force regrading if necessary, rounds the float numbers using php function,
* the reason is we need to compare the db value with computed number to skip regrading if possible.
* Also sets aggregationcoef to 1 if unset: 0 would negate it in the mean
* @param string $source from where was the object inserted (mod/forum, manual, etc.)
* @return boolean success
*/
Expand All @@ -268,6 +269,10 @@ function update($source=null) {

$this->timemodified = time();

if (is_null($this->aggregationcoef)) {
$this->aggregationcoef = 1;
}

$this->grademin = grade_floatval($this->grademin);
$this->grademax = grade_floatval($this->grademax);
$this->multfactor = grade_floatval($this->multfactor);
Expand Down Expand Up @@ -1878,7 +1883,7 @@ function get_formatted_range($rangesdisplaytype=null, $rangesdecimalpoints=null)
global $USER;

// Determine which display type to use for this average
if ($USER->gradeediting[$this->courseid]) {
if (isset($USER->gradeediting) && $USER->gradeediting[$this->courseid]) {
$displaytype = GRADE_DISPLAY_TYPE_REAL;

} else if ($rangesdisplaytype == GRADE_REPORT_PREFERENCE_INHERIT) { // no ==0 here, please resave report and user prefs
Expand Down

0 comments on commit 13cd357

Please sign in to comment.