Skip to content

Commit 167fa09

Browse files
committed
Fix an LTI grade passback issue.
The issue occurs when the `$LTIGradeMode` is "course", `$LTIGradeOnSubmit` is 1, `$LTISendScoresAfterDate` is "reduced_scoring_datae', and `$LTISendGradesEarlyThreshold` is "attempted". In this case if a user grades a test and receives a score of 0 (and all versions of this test have a score of 0), then the `grade_gateway` method returns the default `$bestSetData` array defined at the beginning of the method with only two elements. It does not have the array of problem records. So when the `getSetPassbackScore` method gets the return value and assigns it to `($totalRight, $total, $problemRecords, $setVersions)` the set versions that are returned end up assigned to the `$problemRecords` variable. That causes an exception when the `setAttempted` method tries to call the `attempted` method on a set version which does not have that method. So just add an empty array as the third value in the default `$bsetSetData` array. This works in all calling scenarios.
1 parent 6d54327 commit 167fa09

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/WeBWorK/Utils/Sets.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ sub grade_set ($db, $set, $studentName, $setIsVersioned = 0, $wantProblemDetails
107107
}
108108

109109
sub grade_gateway ($db, $setName, $studentName) {
110-
my $bestSetData = [ 0, 0 ];
110+
my $bestSetData = [ 0, 0, [] ];
111111

112112
my @setVersions = $db->getSetVersionsWhere({ user_id => $studentName, set_id => { like => "$setName,v\%" } });
113113
for (@setVersions) {

0 commit comments

Comments
 (0)