Skip to content

Conversation

@drgrice1
Copy link
Member

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.

This fixes the issue posted at https://forums.openwebwork.org/mod/forum/discuss.php?d=8798.

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.
@drgrice1 drgrice1 force-pushed the bugfix/lti-grade-passback branch from 167fa09 to fcd214d Compare January 13, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant