MDL-9506 Almost completed category aggregation, including generation of raw and final grades held by these categories. Only a few small glitches remain, that cause these grades not to be generated properly. This is the last critical element of the gradebook API, so I'm looking forward to finishing it :-)

This commit is contained in:
nicolasconnault 2007-05-11 08:46:34 +00:00
parent 57b4877d87
commit 2df712352d
6 changed files with 180 additions and 68 deletions

View file

@ -222,7 +222,15 @@ function grades_grab_grades() {
* @param float $target_max
* @return float Converted value
*/
function standardise_score($gradevalue, $source_min, $source_max, $target_min, $target_max) {
function standardise_score($gradevalue, $source_min, $source_max, $target_min, $target_max, $debug=false) {
if ($debug) {
echo 'standardise_score debug info: (lib/gradelib.php)';
print_object(array('gradevalue' => $gradevalue,
'source_min' => $source_min,
'source_max' => $source_max,
'target_min' => $target_min,
'target_max' => $target_max));
}
$factor = ($gradevalue - $source_min) / ($source_max - $source_min);
$diff = $target_max - $target_min;
$gradevalue = $factor * $diff + $target_min;