Fix an LTI grade passback issue.#2886
Merged
somiaj merged 1 commit intoopenwebwork:developfrom Feb 3, 2026
Merged
Conversation
167fa09 to
fcd214d
Compare
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.
fcd214d to
dd5d04a
Compare
Alex-Jordan
approved these changes
Feb 3, 2026
somiaj
approved these changes
Feb 3, 2026
Contributor
somiaj
left a comment
There was a problem hiding this comment.
Looks like a simple fix. Can't fully test though.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The issue occurs when the
$LTIGradeModeis "course",$LTIGradeOnSubmitis 1,$LTISendScoresAfterDateis "reduced_scoring_datae', and$LTISendGradesEarlyThresholdis "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_gatewaymethod returns the default$bestSetDataarray defined at the beginning of the method with only two elements. It does not have the array of problem records. So when thegetSetPassbackScoremethod gets the return value and assigns it to($totalRight, $total, $problemRecords, $setVersions)the set versions that are returned end up assigned to the$problemRecordsvariable. That causes an exception when thesetAttemptedmethod tries to call theattemptedmethod on a set version which does not have that method.So just add an empty array as the third value in the default
$bsetSetDataarray. This works in all calling scenarios.This fixes the issue posted at https://forums.openwebwork.org/mod/forum/discuss.php?d=8798.