Moodle 2.4+ Version  Grading assignments, half rubrics rounding up.

by KTree Computer Solutions Pvt Ltd on December 2015

With every version Moodle updates itself by fixing all the flaws which were reported/present in the previous version. But sometimes it is not feasible to upgrade to  latest version just for the sake of fixing few flaws in the current version of Moodle.

One such requirement is to fix a flaw in Moodle 2.4+ version with regards to grading an assignment. As per the standard feature of Moodle 2.4+  version when we grade an assignment which was scaled based on a rubric, It is not possible to provide decimal grades for students i.e., When a student is graded to a value of 5.7. It will  be rounded up to 5.

 

A Solution to

Rounding up of Rubrics

 
 
What are Rubrics?

Rubrics are advanced grading forms used for criteria-based assessment. The rubric consists of a set of criteria. For each criterion, several descriptive levels are provided. A numerical grade is assigned to each of these levels. The rater chooses which level answers/describes the given criterion best. The raw rubric score is calculated as a sum of all criteria grades. The final grade is calculated by comparing the actual score with the worst/best possible score that could be received.

Fixing Rounding up of Rubrics

In Moodle 2.4+ version when a tutor grade a student based on his submission in an assignment activity based on a rubric set for the assignment activity, the half point rubrics would round up.

This is a Core Bug in Moodle 2.4+ and is resolved from Moodle 2.6+ version onwards and because of this Tutors were facing problems while grading students for assignment activity.

After altering the code we can see the half rubrics are not rounded up as observed here.

 
 

Step1 :Find the file /moodle/grade/grading/form/rubric/lib.php

publicfunction get_grade() { }

Step2 : Find the method get_grade()  at at Line 796  as below

Step3 :In that keep the code after the line sort($graderange);      

$mingrade= $graderange[0];
        $maxgrade= $graderange[sizeof($graderange) - 1];
        $curscore= 0;
        foreach($grade['criteria'] as $id => $record) {
           $curscore +=$this->get_controller()->get_definition()->rubric_criteria[$id]['levels'][$record['levelid']]['score'];
        }
$gradeoffset=($curscore-$scores['minscore'])/($scores['maxscore']-$scores['minscore'])*($maxgrade-$mingrade);
                
                if ($this->get_controller()->get_allow_grade_decimals()) {        
                            return $gradeoffset +$mingrade;                
        }
                
return $gradeoffset + $mingrade;

Please check our next blog on boosting course restore in Moodle