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 12f90ed1b3..6767851d3a 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 @@ -803,6 +803,18 @@ class CombinedOpenEndedV1Module(): return progress_object + def out_of_sync_error(self, get, msg=''): + """ + return dict out-of-sync error message, and also log. + """ + #This is a dev_facing_error + log.warning("Combined module state out sync. state: %r, get: %r. %s", + self.state, get, msg) + #This is a student_facing_error + return {'success': False, + 'error': 'The problem state got out-of-sync. Please try reloading the page.'} + + class CombinedOpenEndedV1Descriptor(): """ diff --git a/common/lib/xmodule/xmodule/tests/test_combined_open_ended.py b/common/lib/xmodule/xmodule/tests/test_combined_open_ended.py index 7cfec5fb62..3b8019290f 100644 --- a/common/lib/xmodule/xmodule/tests/test_combined_open_ended.py +++ b/common/lib/xmodule/xmodule/tests/test_combined_open_ended.py @@ -604,8 +604,10 @@ class OpenEndedModuleXmlTest(unittest.TestCase): #This error is okay. We don't have a grading service to connect to! pass + #Try to get the rubric from the module module.handle_ajax("get_combined_rubric", {}) + #Make a fake reply from the queue queue_reply = { 'queuekey' : "", 'xqueue_body' : json.dumps({ @@ -620,5 +622,20 @@ class OpenEndedModuleXmlTest(unittest.TestCase): }) } + module.handle_ajax("check_for_score", {}) + + #Update the module with the fake queue reply module.handle_ajax("score_update", queue_reply) + #Get html and other data client will request + html = module.get_html() + legend = module.handle_ajax("get_legend", {}) + status = module.handle_ajax("get_status", {}) + legend = module.handle_ajax("skip_post_assessment", {}) + + #Get all results + legend = module.handle_ajax("get_results", {}) + + log.info(module.task_states) + #reset the problem + module.handle_ajax("reset", {})