mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
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:
parent
57b4877d87
commit
2df712352d
6 changed files with 180 additions and 68 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue