Community

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ElenaBaurkot
New Member

Using canvas API to get student submissions - workflow_state shows graded when grade is null

I am trying to get unsubmitted student submissions using the endpoint 'api/v1/courses/:course_id/students/submissions?workflow_state=unsubmitted'. Overall this works, however there seems to be a bug, where if a student did not submit an assignment and the teacher enters a grade, but then removes it so that it's showing as a dash line (or null) in the gradebook, the submission has the workflow_state of graded and doesn't come up with the unsubmitted assignments. Does anyone know a work around for this or would it be possible to update the API so if the assignment was not submitted and a grade is added and then removed it shows unsubmitted since the assignment was in fact unsubmitted and it is no longer graded (even though it may have had a grade at some point)?

0 Kudos
1 Reply
sendres
Community Member

I think the workaround would be to drop the ?workflow_state=unsubmitted qualifier from your request and get all of the submissions regardless of state. You could then iterate over the submissions and look at both the workflow_state and the grade attributes. If the workflow_state is 'graded' or 'unsubmitted' and the grade is null, then treat is as you would an unsubmitted assignment.

Does that sound like it would work for you?