MDL-11835 Changing default aggregateonlygraded back to true, but set this value to...
authornicolasconnault <nicolasconnault>
Fri, 7 Dec 2007 09:14:51 +0000 (09:14 +0000)
committernicolasconnault <nicolasconnault>
Fri, 7 Dec 2007 09:14:51 +0000 (09:14 +0000)
admin/settings/grades.php
lib/db/upgradelib.php
lib/grade/grade_category.php

index 61d86a6c3c49b32359e777bc05e58a95cfe7db5b..3489bd070839dc8f22b19d8d1349f117fb04b85e 100644 (file)
@@ -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'),
index 997a19def22dafceb71fcc30857339ab7cbd85b1..2c038a76c747b3c8a522ca7140b4a0d0baf8d1b9 100644 (file)
@@ -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;
index ed4595b16255d810f1616a8cfa98dd7af329e8f0..0d916a683c932c33836e9c0ce97dd8dfcd94c41a 100644 (file)
@@ -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();