improved aggregation - items without value (none + text) are not aggregated; faster regrading of categroies with no grades; lang typo fixed

This commit is contained in:
skodak 2007-08-03 08:41:20 +00:00
parent 41486d1c40
commit 1eb05d980c
2 changed files with 10 additions and 3 deletions

View File

@ -19,7 +19,7 @@ $string['aggregateminall'] = 'Smallest grade of all grades';
$string['aggregatemingraded'] = 'Smallest grade of non-empty grades';
$string['aggregatemaxall'] = 'Highest grade of all grades';
$string['aggregatemaxgraded'] = 'Highest grade of non-empty grades';
$string['aggregatemodeall'] = 'Mode of non-empty grades of all grades';
$string['aggregatemodeall'] = 'Mode of all grades';
$string['aggregatemodegraded'] = 'Mode of non-empty grades';
$string['aggregateweightedmeanall'] = 'Weighted mean of all grades';
$string['aggregateweightedmeangraded'] = 'Weighted mean of non-empty grades';

View File

@ -1125,16 +1125,23 @@ class grade_item extends grade_object {
}
} else if ($grade_category = $this->load_item_category()) {
//only items with numeric or scale values can be aggregated
if ($this->gradetype != GRADE_TYPE_VALUE and $this->gradetype != GRADE_TYPE_SCALE) {
return array();
}
$sql = "SELECT gi.id
FROM {$CFG->prefix}grade_items gi
WHERE gi.categoryid ={$grade_category->id}
WHERE gi.categoryid = {$grade_category->id}
AND (gi.gradetype = ".GRADE_TYPE_VALUE." OR gi.gradetype = ".GRADE_TYPE_SCALE.")
UNION
SELECT gi.id
FROM {$CFG->prefix}grade_items gi, {$CFG->prefix}grade_categories gc
WHERE (gi.itemtype = 'category' OR gi.itemtype = 'course') AND gi.iteminstance=gc.id
AND gc.parent = {$grade_category->id}";
AND gc.parent = {$grade_category->id}
AND (gi.gradetype = ".GRADE_TYPE_VALUE." OR gi.gradetype = ".GRADE_TYPE_SCALE.")";
if ($children = get_records_sql($sql)) {
return array_keys($children);