Skip to content

Commit

Permalink
MDL-11835 Changing default aggregateonlygraded back to true, but set …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
nicolasconnault committed Dec 7, 2007
1 parent 2bba926 commit 0c87b5a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 2 additions & 3 deletions admin/settings/grades.php
Expand Up @@ -64,15 +64,14 @@
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'),
Expand Down
4 changes: 4 additions & 0 deletions lib/db/upgradelib.php
Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/grade/grade_category.php
Expand Up @@ -318,7 +318,7 @@ function insert_course_category($courseid) {
$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();
Expand Down

0 comments on commit 0c87b5a

Please sign in to comment.