Skip to content
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

change update_score_and_comments to wrap args #602

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion canvasapi/quiz.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,12 +662,19 @@ def update_score_and_comments(self, **kwargs):
:returns: The updated quiz.
:rtype: :class:`canvasapi.quiz.QuizSubmission`
"""
args = dict(**kwargs)
if 'quiz_submissions' not in args:
# we need to wrap the parameters in a quiz_submissions list.
# there will only be one element because this object represents one attempt.
args['attempt'] = self.attempt
args = {'quiz_submissions': [ args ]}

response = self._requester.request(
"PUT",
"courses/{}/quizzes/{}/submissions/{}".format(
self.course_id, self.quiz_id, self.id
),
_kwargs=combine_kwargs(**kwargs),
_kwargs=combine_kwargs(**args),
)
response_json = response.json()["quiz_submissions"][0]
response_json.update({"course_id": self.course_id})
Expand Down