From 0c87b5aac05f81f6c298883e4201957a821cd52b Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Fri, 7 Dec 2007 09:14:51 +0000 Subject: [PATCH] MDL-11835 Changing default aggregateonlygraded back to true, but set this value to false for upgraded course categories. Also set grade display type to percentage for upgraded items, since this is the default setting in 1.8. Site default is Real display type. --- admin/settings/grades.php | 5 ++--- lib/db/upgradelib.php | 4 ++++ lib/grade/grade_category.php | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/admin/settings/grades.php b/admin/settings/grades.php index 61d86a6c3c..3489bd0708 100644 --- a/admin/settings/grades.php +++ b/admin/settings/grades.php @@ -64,15 +64,14 @@ $options = array(GRADE_AGGREGATE_MEAN =>get_string('aggregatemean', ' GRADE_AGGREGATE_MAX =>get_string('aggregatemax', 'grades'), GRADE_AGGREGATE_MODE =>get_string('aggregatemode', 'grades'), GRADE_AGGREGATE_SUM =>get_string('aggregatesum', 'grades')); -$defaults = array('value'=>GRADE_AGGREGATE_WEIGHTED_MEAN, 'forced'=>false, 'adv'=>false); +$defaults = array('value'=>GRADE_AGGREGATE_WEIGHTED_MEAN2, 'forced'=>false, 'adv'=>false); $temp->add(new admin_setting_gradecat_combo('grade_aggregation', get_string('aggregation', 'grades'), get_string('aggregationhelp', 'grades'), $defaults, $options)); $options = array(0 => get_string('no'), 1 => get_string('yes')); -$defaults = array('value'=>0, 'forced'=>false, 'adv'=>true); +$defaults = array('value'=>1, 'forced'=>false, 'adv'=>true); $temp->add(new admin_setting_gradecat_combo('grade_aggregateonlygraded', get_string('aggregateonlygraded', 'grades'), get_string('aggregateonlygradedhelp', 'grades'), $defaults, $options)); -$defaults['value'] = 1; $temp->add(new admin_setting_gradecat_combo('grade_aggregateoutcomes', get_string('aggregateoutcomes', 'grades'), get_string('aggregateoutcomeshelp', 'grades'), $defaults, $options)); $temp->add(new admin_setting_gradecat_combo('grade_aggregatesubcats', get_string('aggregatesubcats', 'grades'), diff --git a/lib/db/upgradelib.php b/lib/db/upgradelib.php index 997a19def2..2c038a76c7 100644 --- a/lib/db/upgradelib.php +++ b/lib/db/upgradelib.php @@ -133,6 +133,7 @@ function upgrade_18_gradebook($courseid) { $course_category->parent = null; $course_category->aggregation = GRADE_AGGREGATE_WEIGHTED_MEAN2; $course_category->timemodified = $course_category->timecreated = time(); + $course_category->aggregateonlygraded = 0; if (!$course_category->id = insert_record('grade_categories', $course_category)) { return false; } @@ -148,6 +149,7 @@ function upgrade_18_gradebook($courseid) { $course_item->itemtype = 'course'; $course_item->iteminstance = $course_category->id; $course_item->gradetype = GRADE_TYPE_VALUE; + $course_item->display = GRADE_DISPLAY_TYPE_PERCENTAGE; $course_item->sortorder = $order++; $course_item->timemodified = $course_item->timecreated = $course_category->timemodified; $course_item->needsupdate = 1; @@ -175,6 +177,7 @@ function upgrade_18_gradebook($courseid) { $category->droplow = $oldcat->drop_x_lowest; $category->aggregation = GRADE_AGGREGATE_WEIGHTED_MEAN2; $category->timemodified = $category->timecreated = time(); + $category->aggregateonlygraded = 0; if (!$category->id = insert_record('grade_categories', $category)) { return false; } @@ -191,6 +194,7 @@ function upgrade_18_gradebook($courseid) { $item->itemtype = 'category'; $item->iteminstance = $category->id; $item->gradetype = GRADE_TYPE_VALUE; + $item->display = GRADE_DISPLAY_TYPE_PERCENTAGE; $item->plusfactor = $oldcat->bonus_points; $item->hidden = $oldcat->hidden; $item->aggregationcoef = $oldcat->weight; diff --git a/lib/grade/grade_category.php b/lib/grade/grade_category.php index ed4595b162..0d916a683c 100644 --- a/lib/grade/grade_category.php +++ b/lib/grade/grade_category.php @@ -318,7 +318,7 @@ class grade_category extends grade_object { $this->fullname = get_string('coursegradecategory', 'grades'); $this->path = null; $this->parent = null; - $this->aggregation = GRADE_AGGREGATE_MEAN; + $this->aggregation = GRADE_AGGREGATE_WEIGHTED_MEAN2; $this->apply_default_settings(); $this->apply_forced_settings(); -- 2.39.5