MDL-18402 Setting aggregationcoef to 1 if left empty
This commit is contained in:
@@ -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
|
||||
*/
|
||||
@@ -268,6 +269,10 @@ class grade_item extends grade_object {
|
||||
|
||||
$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);
|
||||
@@ -1878,7 +1883,7 @@ class grade_item extends grade_object {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user