Commit 6d3d69a2 by Brian Wilson

Fix seeds and correctness in non-submission problem check events.

Fix AN-663 and AN-664.

Change-Id: I704e64a7679c8fec35f2e70355b55f6cffb06580
parent b9a9cad9
...@@ -168,13 +168,16 @@ class LastProblemCheckEventMixin(object): ...@@ -168,13 +168,16 @@ class LastProblemCheckEventMixin(object):
# of any actual values selected by the student. # of any actual values selected by the student.
# For now, let's just dump an error and skip it, # For now, let's just dump an error and skip it,
# so that it becomes the equivalent of a hidden # so that it becomes the equivalent of a hidden
# answer. Eventually we would probably want to treat # answer.
# it explicitly as a hidden answer.
# TODO: Eventually treat it explicitly as a hidden
# answer.
if answer_id not in correct_map: if answer_id not in correct_map:
log.error("Unexpected answer_id %s not in correct_map: %s", answer_id, event) log.error("Unexpected answer_id %s not in correct_map: %s", answer_id, event)
continue continue
correctness = correct_map[answer_id].get('correctness') in ['correct']
correct_entry = correct_map[answer_id] variant = event.get('state', {}).get('seed')
# We do not know the values for 'input_type', # We do not know the values for 'input_type',
# 'response_type', or 'question'. We also don't know if # 'response_type', or 'question'. We also don't know if
...@@ -185,8 +188,8 @@ class LastProblemCheckEventMixin(object): ...@@ -185,8 +188,8 @@ class LastProblemCheckEventMixin(object):
# an 'answer' and only sometimes have an 'answer_value_id'. # an 'answer' and only sometimes have an 'answer_value_id'.
submission = { submission = {
'answer_value_id': answer_value, 'answer_value_id': answer_value,
'correct': correct_entry.get('correctness'), 'correct': correctness,
'variant': event.get('seed'), 'variant': variant,
} }
append_submission(answer_id, submission) append_submission(answer_id, submission)
...@@ -457,7 +460,14 @@ class AnswerDistributionPerCourseMixin(object): ...@@ -457,7 +460,14 @@ class AnswerDistributionPerCourseMixin(object):
def get_answer_grouping_key(self, answer): def get_answer_grouping_key(self, answer):
"""Return value to use for uniquely identify an answer value in the distribution.""" """Return value to use for uniquely identify an answer value in the distribution."""
variant = answer.get('variant', 'NO_VARIANT') # For variants, we want to treat missing variants with the
# same value as used for events that lack 'submission'
# information, so that they will be grouped together. That
# value is a seed value of '1'. We want to map both missing
# values and zero-length values to this default value.
variant = answer.get('variant', '')
if variant == '':
variant = '1'
# Events that lack 'submission' information will have a value # Events that lack 'submission' information will have a value
# for 'answer_value_id' and none for 'answer'. Events with # for 'answer_value_id' and none for 'answer'. Events with
# 'submission' information will have the reverse situation # 'submission' information will have the reverse situation
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment