edx/edx-platform — pull request #1563 by jbau (2013-10-31 22:38:55+00:00)
Title: add error handling for update_score for OEE when no child_history

@VikParuchuri @brianhw

For some reason (not yet root caused), we are getting a lot of 500s like this:

```

Traceback (most recent call last):

File "/opt/edx/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)

File "/opt/edx/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 77, in wrapped_view
return view_func(*args, **kwargs)

File "/opt/wwc/edx-platform/lms/djangoapps/courseware/module_render.py", line 503, in xqueue_callback
instance.handle_ajax(dispatch, data)

File "/opt/wwc/edx-platform/common/lib/xmodule/xmodule/combined_open_ended_module.py", line 448, in handle_ajax
return_value = self.child_module.handle_ajax(dispatch, data)

File "/opt/wwc/edx-platform/common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py", line 731, in handle_ajax
return_html = self.current_task.handle_ajax(dispatch, data, self.system)

File "/opt/wwc/edx-platform/common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_module.py", line 618, in handle_ajax
d = handlers[dispatch](data, system)

File "/opt/wwc/edx-platform/common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_module.py", line 676, in update_score
self._update_score(score_msg, queuekey, system)

File "/opt/wwc/edx-platform/common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_module.py", line 284, in _update_score
self.record_latest_score(new_score_msg['score'])

File "/opt/wwc/edx-platform/common/lib/xmodule/xmodule/open_ended_grading_classes/openendedchild.py", line 253, in record_latest_score
self.child_history[-1]['score'] = score

IndexError: list index out of range

```

Which is weird, since if there's no submission, there shouldn't be anything in ORA to be peer graded. But evidently there was a submission in ORA, which did get peer-graded, and did cause the callbacks to update_score to happen.

This is a patch to handle this case for now, because as things stand currently if this case happens, the error will not stop happening without human intervention. (i.e edx-ora-celery will keep pushing to xqueue which will keep pushing to lms, because all the response codes will be 500s which propagate back and don't cause any state changes in the respective databases)