API: Is there a way to request only ungraded submissions?

Jump to solution
howderek
Community Novice


I am building an external tool that helps teachers and TAs coordinate who is grading what in classes with hundreds of students. The way I've currently been getting ungraded submissions is by requesting all submissions for an assignment and then iterating through that list and looking for submissions without scores.

I've run into some trouble however, because since we have so many students in the course, each assignment has hundreds of submissions, and I'll have to use pagination in order to get all of the data I need to do it this way. This seems like an unreasonable amount of API requests to make over and over again, (roughly 40 each time my tool refreshes).

Is there a method in the API that returns only submissions that do not have scores?

Labels (1)
1 Solution
cesbrandt
Community Champion

howderek, following up on  @garth 's post​, there is no "one-stop-shop" for this. You can use the List assignments API with the bucket parameter set to "ungraded" to get a list of assignments with ungraded submissions. Then cycle through the results and pull the submissions for each of those assignments using the List assignment submissions API. Lastly, filter those results down to only those with a grade value of null.

A mock-up for the logic would be something like:

ungradedAssignments = GET /api/v1/courses/:course_id/assignments?bucket=upgraded

ungradedSubmissions = new Array

FOREACH ungradedAssignments AS ungradedAssignment

     submissions = GET /api/v1/courses/:course_id/assignments/ && ungradedAssignment[id] && /submissions

     FOREACH submissions AS submission

          IF submission[grade] IS NULL

               APPEND submission TO ARRAY ungradedSubmissions

          END IF

     END FOREACH

END FOREACH

Note: This is a rough-sketch pseudocode. The end result would be a single array, ungradedSubmissions, of all ungraded activity submissions for a course , regardless of the activity they belong to. Of course, each submission will contain the assignment_id, it should be easy to pair with the actual assignment, should you want to prettify the output.

View solution in original post