From 9f105e54cd62d537bb27f14a13cc7c5835072ae2 Mon Sep 17 00:00:00 2001 From: jszewczulak <128841175+jszewczulak@users.noreply.github.com> Date: Mon, 2 Oct 2023 14:56:12 -0400 Subject: [PATCH] fix: Replaced UsageKey with CourseKey for the course lookup (#2062) * fix: replaced UsageKey with CourseKey for the course lookup --- openassessment/__init__.py | 2 +- .../workflow/test/test_workflow_batch_update_api.py | 9 +++++++-- openassessment/workflow/workflow_batch_update_api.py | 4 ++-- package.json | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/openassessment/__init__.py b/openassessment/__init__.py index cdd601e657..c2c752235d 100644 --- a/openassessment/__init__.py +++ b/openassessment/__init__.py @@ -2,4 +2,4 @@ Initialization Information for Open Assessment Module """ -__version__ = '5.5.1' +__version__ = '5.5.2' diff --git a/openassessment/workflow/test/test_workflow_batch_update_api.py b/openassessment/workflow/test/test_workflow_batch_update_api.py index a8e261eb24..5a787dd3b2 100644 --- a/openassessment/workflow/test/test_workflow_batch_update_api.py +++ b/openassessment/workflow/test/test_workflow_batch_update_api.py @@ -145,9 +145,14 @@ def test_is_flexible_peer_grading_on(self): @patch('openassessment.workflow.workflow_batch_update_api.modulestore') @patch('openassessment.workflow.workflow_batch_update_api.UsageKey.from_string') - def test_get_workflow_update_data(self, mocked_from_string, mocked_modulestore): + @patch('openassessment.workflow.workflow_batch_update_api.CourseKey.from_string') + def test_get_workflow_update_data(self, + mocked_usage_key_from_string, + mocked_course_key_from_string, + mocked_modulestore): mocked_modulestore.return_value = MockModulestore() - mocked_from_string.side_effect = mock_from_string + mocked_usage_key_from_string.side_effect = mock_from_string + mocked_course_key_from_string.side_effect = mock_from_string peer_workflows = self.get_peer_workflows() wup = update_api.get_workflow_update_data(peer_workflows) diff --git a/openassessment/workflow/workflow_batch_update_api.py b/openassessment/workflow/workflow_batch_update_api.py index 8be1f12a49..c920dc92a6 100644 --- a/openassessment/workflow/workflow_batch_update_api.py +++ b/openassessment/workflow/workflow_batch_update_api.py @@ -7,7 +7,7 @@ import datetime from django.utils import timezone -from opaque_keys.edx.keys import UsageKey +from opaque_keys.edx.keys import UsageKey, CourseKey from openassessment.runtime_imports.functions import modulestore from openassessment.assessment.models import PeerWorkflow from openassessment.workflow import api @@ -315,7 +315,7 @@ def get_workflow_update_data(peer_workflows): try: if peer_workflow.course_id not in course_settings_cache: # retrieve course block from DB - course_block_key = UsageKey.from_string(peer_workflow.course_id) + course_block_key = CourseKey.from_string(peer_workflow.course_id) course_block = store.get_item(course_block_key) # add course settings to temp cache course_settings_cache[peer_workflow.course_id] = { diff --git a/package.json b/package.json index ec1490979a..767616cf3d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "edx-ora2", - "version": "5.5.0", + "version": "5.5.2", "repository": "https://github.com/openedx/edx-ora2.git", "dependencies": { "@edx/frontend-build": "^6.1.1",