Moderate Quiz - Attempts Left

Jump to solution
MattHanes
Community Champion

Does anyone know of an API call that can return the number of remaining attempts a student has for a quiz? Basically I'm looking for how to return the "attempts left" number that is on the "Moderate Quiz" screen using the API.

1 Solution
tyler_clair
Community Champion

Hi Matt,

It looks like there is an actual attempts_left indicator when you return the submissions for a quiz and even when you return a specific quiz submission. It doesn't look like its in the API docs but it does get returned when I make a submissions call. See https://canvas.instructure.com/doc/api/quiz_submissions.html#method.quizzes/quiz_submissions_api.ind... for more information.

For students that do not have a submission you could run a simple check to see if their user_id matches any submissions and if they don't you could then get the allowed_attempts from the quiz settings, https://usu.instructure.com/doc/api/quizzes.html#method.quizzes/quizzes_api.show, and just display that till they have a submission then fall back on the attempts_left from the submission.

Hope that point you in the right direction.

Tyler

View solution in original post