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 8eaff34b64..cfa9db908b 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 @@ -10,8 +10,9 @@ from xmodule.open_ended_grading_classes import self_assessment_module from xmodule.open_ended_grading_classes import open_ended_module from xmodule.util.duedate import get_extended_due_date from .combined_open_ended_rubric import CombinedOpenEndedRubric, GRADER_TYPE_IMAGE_DICT, HUMAN_GRADER_TYPE, LEGEND_LIST -from xmodule.open_ended_grading_classes.peer_grading_service import PeerGradingService, MockPeerGradingService, GradingServiceError +from xmodule.open_ended_grading_classes.peer_grading_service import PeerGradingService, MockPeerGradingService from xmodule.open_ended_grading_classes.openendedchild import OpenEndedChild +from xmodule.open_ended_grading_classes.grading_service_module import GradingServiceError log = logging.getLogger("edx.courseware") @@ -800,7 +801,7 @@ class CombinedOpenEndedV1Module(): success = False allowed_to_submit = True try: - response = self.peer_gs.get_data_for_location(self.location.to_deprecated_string(), student_id) + response = self.peer_gs.get_data_for_location(self.location, student_id) count_graded = response['count_graded'] count_required = response['count_required'] student_sub_count = response['student_sub_count'] diff --git a/common/lib/xmodule/xmodule/open_ended_grading_classes/peer_grading_service.py b/common/lib/xmodule/xmodule/open_ended_grading_classes/peer_grading_service.py index 50d654a0bd..c15f83b305 100644 --- a/common/lib/xmodule/xmodule/open_ended_grading_classes/peer_grading_service.py +++ b/common/lib/xmodule/xmodule/open_ended_grading_classes/peer_grading_service.py @@ -1,8 +1,8 @@ -import json import logging from dogapi import dog_stats_api -from .grading_service_module import GradingService, GradingServiceError +from .grading_service_module import GradingService +from xmodule.modulestore.keys import UsageKey log = logging.getLogger(__name__) @@ -30,6 +30,8 @@ class PeerGradingService(GradingService): self.system = system def get_data_for_location(self, problem_location, student_id): + if isinstance(problem_location, UsageKey): + problem_location = problem_location.to_deprecated_string() params = {'location': problem_location, 'student_id': student_id} result = self.get(self.get_data_for_location_url, params) self._record_result('get_data_for_location', result) @@ -44,6 +46,8 @@ class PeerGradingService(GradingService): return result def get_next_submission(self, problem_location, grader_id): + if isinstance(problem_location, UsageKey): + problem_location = problem_location.to_deprecated_string() result = self._render_rubric(self.get( self.get_next_submission_url, { @@ -62,6 +66,8 @@ class PeerGradingService(GradingService): return result def is_student_calibrated(self, problem_location, grader_id): + if isinstance(problem_location, UsageKey): + problem_location = problem_location.to_deprecated_string() params = {'problem_id': problem_location, 'student_id': grader_id} result = self.get(self.is_student_calibrated_url, params) self._record_result( @@ -72,6 +78,8 @@ class PeerGradingService(GradingService): return result def show_calibration_essay(self, problem_location, grader_id): + if isinstance(problem_location, UsageKey): + problem_location = problem_location.to_deprecated_string() params = {'problem_id': problem_location, 'student_id': grader_id} result = self._render_rubric(self.get(self.show_calibration_essay_url, params)) self._record_result('show_calibration_essay', result) diff --git a/common/lib/xmodule/xmodule/peer_grading_module.py b/common/lib/xmodule/xmodule/peer_grading_module.py index cfe8667213..7e2bb6dac7 100644 --- a/common/lib/xmodule/xmodule/peer_grading_module.py +++ b/common/lib/xmodule/xmodule/peer_grading_module.py @@ -13,10 +13,11 @@ from xmodule.raw_module import RawDescriptor from xmodule.timeinfo import TimeInfo from xmodule.util.duedate import get_extended_due_date from xmodule.x_module import XModule, module_attr -from xmodule.open_ended_grading_classes.peer_grading_service import PeerGradingService, GradingServiceError, MockPeerGradingService +from xmodule.open_ended_grading_classes.peer_grading_service import PeerGradingService, MockPeerGradingService from open_ended_grading_classes import combined_open_ended_rubric from django.utils.timezone import UTC +from xmodule.open_ended_grading_classes.grading_service_module import GradingServiceError log = logging.getLogger(__name__) diff --git a/common/lib/xmodule/xmodule/tests/test_peer_grading.py b/common/lib/xmodule/xmodule/tests/test_peer_grading.py index 8f2e679b4a..75b494e55c 100644 --- a/common/lib/xmodule/xmodule/tests/test_peer_grading.py +++ b/common/lib/xmodule/xmodule/tests/test_peer_grading.py @@ -72,7 +72,7 @@ class PeerGradingModuleTest(unittest.TestCase, DummyModulestore): Try getting data from the external grading service @return: """ - success, _data = self.peer_grading.query_data_for_location(self.problem_location.to_deprecated_string()) + success, _data = self.peer_grading.query_data_for_location(self.problem_location) self.assertTrue(success) def test_get_score_none(self): diff --git a/lms/templates/peer_grading/peer_grading_problem.html b/lms/templates/peer_grading/peer_grading_problem.html index a580e5aee4..52c6f6ced0 100644 --- a/lms/templates/peer_grading/peer_grading_problem.html +++ b/lms/templates/peer_grading/peer_grading_problem.html @@ -1,6 +1,6 @@ <%! from django.utils.translation import ugettext as _ %>
-
+