From 912800cabf92d2f3000a67e849c3c4fce7c94c86 Mon Sep 17 00:00:00 2001 From: Vik Paruchuri Date: Wed, 20 Feb 2013 17:27:37 -0500 Subject: [PATCH 1/2] Fix location string object problems --- .../open_ended_grading_classes/open_ended_module.py | 4 ++-- .../xmodule/open_ended_grading_classes/openendedchild.py | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_module.py b/common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_module.py index 96d75b366c..0b546482f4 100644 --- a/common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_module.py +++ b/common/lib/xmodule/xmodule/open_ended_grading_classes/open_ended_module.py @@ -108,7 +108,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild): self.answer = find_with_default(oeparam, 'answer_display', 'No answer given.') parsed_grader_payload.update({ - 'location': system.location.url(), + 'location': self.location_string, 'course_id': system.course_id, 'prompt': prompt_string, 'rubric': rubric_string, @@ -138,7 +138,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild): """ event_info = dict() - event_info['problem_id'] = system.location.url() + event_info['problem_id'] = self.location_string event_info['student_id'] = system.anonymous_student_id event_info['survey_responses'] = get diff --git a/common/lib/xmodule/xmodule/open_ended_grading_classes/openendedchild.py b/common/lib/xmodule/xmodule/open_ended_grading_classes/openendedchild.py index dd8fa2a54e..01ccf4c7ac 100644 --- a/common/lib/xmodule/xmodule/open_ended_grading_classes/openendedchild.py +++ b/common/lib/xmodule/xmodule/open_ended_grading_classes/openendedchild.py @@ -108,6 +108,12 @@ class OpenEndedChild(object): self.peer_gs = PeerGradingService(system.open_ended_grading_interface, system) self.system = system + self.location_string = location + try: + self.location_string = self.location_string.url() + except: + pass + self.setup_response(system, location, definition, descriptor) def setup_response(self, system, location, definition, descriptor): @@ -418,7 +424,8 @@ class OpenEndedChild(object): return success, string def check_if_student_can_submit(self): - location = self.system.location.url() + location = self.location_string + student_id = self.system.anonymous_student_id success = False allowed_to_submit = True From c55f99708655de9350ecbb230f7fc073fa3ea89f Mon Sep 17 00:00:00 2001 From: Vik Paruchuri Date: Wed, 20 Feb 2013 17:34:51 -0500 Subject: [PATCH 2/2] Fix self assessment tests --- common/lib/xmodule/xmodule/tests/test_self_assessment.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/lib/xmodule/xmodule/tests/test_self_assessment.py b/common/lib/xmodule/xmodule/tests/test_self_assessment.py index f197aebc08..b9c3076b7c 100644 --- a/common/lib/xmodule/xmodule/tests/test_self_assessment.py +++ b/common/lib/xmodule/xmodule/tests/test_self_assessment.py @@ -67,10 +67,18 @@ class SelfAssessmentTest(unittest.TestCase): def get_fake_item(name): return responses[name] + def get_data_for_location(self,location,student): + return { + 'count_graded' : 0, + 'count_required' : 0, + 'student_sub_count': 0, + } + mock_query_dict = MagicMock() mock_query_dict.__getitem__.side_effect = get_fake_item mock_query_dict.getlist = get_fake_item + self.module.peer_gs.get_data_for_location = get_data_for_location self.assertEqual(self.module.get_score()['score'], 0)