MDL-50218 lti: Return empty grade when none exists

This commit is contained in:
John Okely
2016-03-04 16:26:08 +08:00
parent 7adc7ef14f
commit e42b23ebe2
2 changed files with 8 additions and 6 deletions
+3 -6
View File
@@ -217,14 +217,11 @@ function lti_read_grade($ltiinstance, $userid) {
if (!empty($ltigrade) && isset($grades) && isset($grades->items[0]) && is_array($grades->items[0]->grades)) {
foreach ($grades->items[0]->grades as $agrade) {
$grade = $agrade->grade;
$grade = $grade / $ltigrade;
break;
if (isset($grade)) {
return $grade / $ltigrade;
}
}
}
if (isset($grade)) {
return $grade;
}
}
function lti_delete_grade($ltiinstance, $userid) {
+5
View File
@@ -1,5 +1,10 @@
This files describes API changes in the lti code.
=== 3.1 ===
* When requesting a grade from the outcome service, and empty grade will now be returned as
an empty grade in accordance with the spec. Previously a grade of 0 would be returned.
=== 3.0 ===
* Function lti_view (locallib.php) was renamed to lti_launch_tool.