From 97d608ba0532066dfb60cbeb213ad4d1f13a81f4 Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Tue, 26 Jun 2007 08:50:22 +0000 Subject: [PATCH] Changed grade_item so that its grademax is count(scale_items) and grademin is 1, to be consistent with use of scales throughout Moodle. --- lib/grade/grade_item.php | 7 +++++-- lib/gradelib.php | 9 +++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/grade/grade_item.php b/lib/grade/grade_item.php index ccf797c706..6adddb038a 100644 --- a/lib/grade/grade_item.php +++ b/lib/grade/grade_item.php @@ -749,8 +749,11 @@ class grade_item extends grade_object { if (!empty($this->scaleid)) { $this->scale = grade_scale::fetch(array('id'=>$this->scaleid)); $this->scale->load_items(); - $this->grademax = count($this->scale->scale_items) - 1; - $this->grademin = 0; + + // Until scales are uniformly set to min=0 max=count(scaleitems)-1 throughout Moodle, we + // stay with the current min=1 max=count(scaleitems) + $this->grademax = count($this->scale->scale_items); + $this->grademin = 1; } else { $this->scale = null; } diff --git a/lib/gradelib.php b/lib/gradelib.php index 586344bab7..1854d0cda9 100644 --- a/lib/gradelib.php +++ b/lib/gradelib.php @@ -576,11 +576,12 @@ function grade_get_legacy_grade_item($modinstance, $grademax, $scaleid) { } else if ($scaleid) { $grade_item->gradetype = GRADE_TYPE_SCALE; $grade_item->scaleid = $scaleid; + $grade_item->grademin = 1; } else { - $grade_item->gradetype = GRADE_TYPE_VALUE; - $grade_item->grademax = $grademax; - $grade_item->grademin = 0; + $grade_item->gradetype = GRADE_TYPE_VALUE; + $grade_item->grademax = $grademax; + $grade_item->grademin = 0; } $grade_item->itemname = $modinstance->name; @@ -606,7 +607,7 @@ function grade_get_legacy_grade_item($modinstance, $grademax, $scaleid) { } else if ($scaleid) { $params['gradetype'] = GRADE_TYPE_SCALE; $params['scaleid'] = $scaleid; - + $grade_item->grademin = 1; } else { $params['gradetype'] = GRADE_TYPE_VALUE; $params['grademax'] = $grademax; -- 2.39.5