Quantcast
Channel: LTI and Moodle
Viewing all articles
Browse latest Browse all 2848

LTI grade sync and scales

$
0
0
by Kirk Martinson.  

After realizing that we were unable to translate LTI-reported grades (e.g. from Google Assignments) correctly to a scaled grade in the gradebook, I went digging about and discovered that the scaling from the LTI-reported percentage (0 to 1 value) was being multiplied by the 'grade' column in the lti table - which is not the max grade for scaled activities, but rather the negative of its scale id number.

I was able to rectify this with a bit of code in the servicelib.php file of the lti module, in the lti_update_grade function, catching any negative value for the $ltiinstance->grade value, and in those cases multiplying by the 'grademax' value from the grade_item table instead (pulled using the courseid, iteminstance values from $ltiinstance, and setting 'itemmodule' to lti). So far, this seems to work for me, but I'm almost certain it's not the best fix, and I'm wondering a) why this hasn't already been addressed in the core code, and b) if this needs to be reported as a bug to be implemented, or if my setup is somehow not catching and converting these values in a way that is already implemented.

Thanks,

kirk

Code change to servicelib.php:

        $gradeval = $gradeval * floatval($ltiinstance->grade);

changed to:

    if ($ltiinstance->grade < 0) {

        $gradeitem = $DB->get_record('grade_items', array(

             'iteminstance' => $ltiinstance->id,

     'courseid' => $ltiinstance->course,

     'itemmodule' => LTI_ITEM_MODULE));

$maxgrade = $gradeitem->grademax;

        $gradeval = $gradeval * $maxgrade;

    } else {

        $gradeval = $gradeval * floatval($ltiinstance->grade);

    }


Viewing all articles
Browse latest Browse all 2848

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>