packbackbooks / lti-1-3-php-library

A library used for building IMS-certified LTI 1.3 tool providers in PHP.
Apache License 2.0
39 stars 25 forks source link

Allow getGrades() without a line item #34

Closed mattwright closed 3 years ago

mattwright commented 3 years ago

Summary of Changes

I was using putGrade() without a custom line item, as shown in the wiki for this project:

https://github.com/packbackbooks/lti-1-3-php-library/wiki/Calling-Services#assignments-and-grades-service

However, when I tried to call getGrades(), it required a line item. I modified the source so that it will pull the line item url from the service data, just as it does in putGrade() when called without a custom line item.

My error log was also complaining of no argument passed to $request->setAccept(), so I set it to static::CONTENTTYPE_RESULTCONTAINER, but have no idea if that is correct, or instead I should have just removed the setAccept() call altogether.

Testing

Manually tested only with the default line item in Canvas. I would suggest testing on your end to ensure custom line items still work and that I didn't break anything, although I tried to only change the code path where a line item is not supplied, and keep it similar to the way it operates in putGrade().