Skip to content

Commit e741233

Browse files
committed
fix: adjust studio_grading_url to use the correct URL
1 parent c3d0c17 commit e741233

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

lms/djangoapps/instructor/tests/test_api_v2.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ def _get_url(self, course_id=None):
118118
course_id = str(self.course_key)
119119
return reverse('instructor_api_v2:course_metadata', kwargs={'course_id': course_id})
120120

121+
@override_settings(COURSE_AUTHORING_MICROFRONTEND_URL='http://localhost:2001/authoring')
121122
def test_get_course_metadata_as_instructor(self):
122123
"""
123124
Test that an instructor can retrieve comprehensive course metadata.
@@ -173,6 +174,9 @@ def test_get_course_metadata_as_instructor(self):
173174
self.assertIn('has_ended', data) # noqa: PT009
174175
self.assertIn('analytics_dashboard_message', data) # noqa: PT009
175176

177+
assert 'studio_grading_url' in data
178+
assert data['studio_grading_url'] == f'http://localhost:2001/authoring/course/{self.course.id}/settings/grading'
179+
176180
def test_get_course_metadata_as_staff(self):
177181
"""
178182
Test that course staff can retrieve course metadata.

lms/djangoapps/instructor/views/serializers_v2.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from lms.djangoapps.instructor.access import FORUM_ROLES, ROLES
3333
from lms.djangoapps.instructor.views.instructor_dashboard import get_analytics_dashboard_message
3434
from openedx.core.djangoapps.django_comment_common.models import FORUM_ROLE_ADMINISTRATOR
35+
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
3536
from xmodule.modulestore.django import modulestore
3637

3738
from .tools import DashboardError, get_student_from_identifier, parse_datetime
@@ -454,7 +455,11 @@ def get_gradebook_url(self, data):
454455
def get_studio_grading_url(self, data):
455456
"""Get Studio MFE grading settings URL for the course."""
456457
course_key = data['course'].id
457-
mfe_base_url = getattr(settings, 'COURSE_AUTHORING_MICROFRONTEND_URL', None)
458+
mfe_base_url = configuration_helpers.get_value_for_org(
459+
course_key.org,
460+
'COURSE_AUTHORING_MICROFRONTEND_URL',
461+
settings.COURSE_AUTHORING_MICROFRONTEND_URL
462+
)
458463
if mfe_base_url:
459464
return f'{mfe_base_url}/course/{course_key}/settings/grading'
460465
return None

0 commit comments

Comments
 (0)