Skip to content

Commit

Permalink
MCKIN-12600 key error on filtering username (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
mudassir-hafeez committed Apr 22, 2021
1 parent dfc9136 commit cb4125e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions problem_builder/tasks.py
Expand Up @@ -116,15 +116,17 @@ def _extract_data(course_key_str, block, user_id, match_string):
# - Get all of the most recent student submissions for this block:
submissions = tuple(_get_submissions(course_key_str, block, user_id))

student_ids = [submission['student_id'] for submission in submissions]
# If the student ID key doesn't exist, we're dealing with a single student and know the ID already.
student_ids = [submission.get('student_id', user_id) for submission in submissions]
users = get_users_by_anonymous_ids(student_ids)

# - For each submission, look up student's username, email and answer:
answer_cache = {}
for submission in submissions:
student_id = submission.get('student_id', user_id)
username, _user_id, user_email = users.get(
submission['student_id'],
(submission['student_id'], 'N/A', 'N/A')
student_id,
(student_id, 'N/A', 'N/A')
)
answer = _get_answer(block, submission, answer_cache)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -28,7 +28,7 @@

# Constants #########################################################

VERSION = '4.1.11'
VERSION = '4.1.12'

# Functions #########################################################

Expand Down

0 comments on commit cb4125e

Please sign in to comment.