-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot access student's answer to an essay quiz question #530
Comments
I'm not sure this is a library bug, but could be an enhancement. In my experience, it is notoriously difficult to get quiz submission data from Canvas because the objects are so abstracted into different classes. I think the API has like six different For instance, the Each quiz has a separate # set up your Canvas object
course = canvas.get_course(12345)
quiz = course.get_quiz(999999)
assignment = course.get_assignment(quiz.assignment_id)
# Now get the assignment submissions
submissions = assignment.get_submissions(include='submission_history')
for sub in submissions:
text = sub.submission_history[0]['submission_data']
# [{'correct': 'undefined', 'points': 0.0, 'question_id': 870320, 'text': '<p>This is the answer to the essay.</p>'}] As far as enhancing the library, it would be nice to have a method to automatically return those submissions via the Assignment model rather than manually getting the ID and then requesting the submissions. I'm not sure how deep down that trail Matt and Jesse want to go because they've stuck pretty close to a direct implementation of the Canvas API as-is. |
Mmi oahmmimjiiblugoj u mmm |
Describe the bug
I cannot find a way to access the answer that a student gives to an
essay_question
quiz question. This may be due to a missing attribute, or my overlooking some option.To Reproduce
Supposing that the indicated quiz contains only a single
essay_question
question, then after running this code:... I would expect
subs[0].body
or some other aptly named attribute to contain the text that the student gave as an answer. For a similar assignment, the student's answer is available to me in theSubmission
object as.body
or in case of a URL, as.url
-- assubs[0]
here is also aSubmission
, I would expect a similar attribute to be present. Note thatsubs[0].workflow_state
ispending_review
, and if I manually check in SpeedGrader, the student's solution is there.I've looked all over the different
QuizX
classes and tried to use several combinations of attributes, but I cannot find the appropriate way to get the textual answer of the student. For example,quiz.get_questions()[0].answers
is also empty. I can find all other data such as the student's name, question name and text etc.Expected behavior
Have a clear and concise way to access the submitted answers.
If an attribute is missing, add it to the API. If there is a way already, and I've missed it, kindly show me.
Environment information
The text was updated successfully, but these errors were encountered: