Commit dd779933 by Awais Jibran

Making the code more robust to handle an edge case

Do not break when a dict does not contain an key.

EDUCATOR-1832
parent 66fc6d9b
...@@ -718,7 +718,7 @@ class DragAndDropBlock( ...@@ -718,7 +718,7 @@ class DragAndDropBlock(
item = self._get_item_definition(item_attempt['val']) item = self._get_item_definition(item_attempt['val'])
is_correct = self._is_attempt_correct(item_attempt) is_correct = self._is_attempt_correct(item_attempt)
if item_attempt['zone'] is None: if item_attempt['zone'] is None:
del self.item_state[str(item['id'])] self.item_state.pop(str(item['id']), None)
self._publish_item_to_bank_event(item['id'], is_correct) self._publish_item_to_bank_event(item['id'], is_correct)
else: else:
# State is always updated in assessment mode to store intermediate item positions # State is always updated in assessment mode to store intermediate item positions
......
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