. Looking at the documentation for the Quiz Submissions API it shows that a time_spent value is returned for each recorded attempt which appears to be what I need. The documentation for "Get all quiz submissions" https://canvas.instructure.com/doc/api/quiz_submissions.html#method.quizzes/quiz_submissions_api.index indicates (emphasis added):
- "Get a list of all submissions for this quiz. Users who can view or manage grades for a course will have submissions from multiple users returned. A user who can only submit will have only their own submissions returned. When a user has an in-progress submission, only that submission is returned. When there isn't an in-progress quiz_submission, all completed submissions, including previous attempts, are returned."
However it appears that the API does not behave this way. When a student has more than one attempt, only the most recent attempt is actually returned. Looking at the source code for Canvas, the issue appears to be in https://github.com/instructure/canvas-lms/blob/master/app/controllers/quizzes/quiz_submissions_api_controller.rb#L170-L189 where there is an if statement that ensures all attempts are returned only if the requester is a student.
Can someone verify this behavior? Is this a bug with the documentation or with the API?