Skip to content
Merged
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
8 changes: 7 additions & 1 deletion problem_builder/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,16 @@ def _get_submissions(course_key_str, block, user_id):
def _get_username(submission, user_id):
"""
Return username of student who provided `submission`.

If the anonymous id of the submission can't be resolved into a username, the anonymous
id is returned.
"""
# If the student ID key doesn't exist, we're dealing with a single student and know the ID already.
student_id = submission.get('student_id', user_id)
return user_by_anonymous_id(student_id).username
user = user_by_anonymous_id(student_id)
if user is None:
return student_id
return user.username


def _get_answer(block, submission, answer_cache):
Expand Down