diff --git a/common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py b/common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py index ba36e1e2ee..abf6474b00 100644 --- a/common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py +++ b/common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py @@ -145,18 +145,17 @@ class CombinedOpenEndedV1Module(): If that is the case, delete it. """ + info_message = "Combined open ended user state for user {0} in location {1} was invalid. Reset it.".format(self.system.anonymous_student_id, self.location.url()) #If we are on a task that is greater than the number of available tasks, it is an invalid state - if self.current_task_number>len(self.task_states): - self.task_states = [] - self.current_task_number = 0 #If the current task number is greater than the number of tasks we have in the xml definition, our state is invalid. - elif self.current_task_number>len(self.task_xml): - self.task_states = [] - self.current_task_number = 0 - #if the length of the task xml is less than the length of the task states, state is invalid + if self.current_task_number>len(self.task_states) or self.current_task_number>len(self.task_xml): + self.current_task_number = min([len(self.task_states),len(self.task_xml)]) + log.info(info_message) + #If the length of the task xml is less than the length of the task states, state is invalid elif len(self.task_xml)