Skip to content

Commit b1a10b7

Browse files
chore: update to use 'title' instead of 'display_name' in openedx_catalog
1 parent d0e557c commit b1a10b7

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

openedx/core/djangoapps/content/course_overviews/migrations/0030_backfill_new_catalog_courseruns.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
}
2020

2121

22-
def backfill_openedx_catalog(apps, schema_editor):
22+
def backfill_openedx_catalog(apps, schema_editor) -> None:
2323
"""
2424
Populate the new CourseRun and CatalogCourse models.
2525
"""
@@ -63,7 +63,7 @@ def backfill_openedx_catalog(apps, schema_editor):
6363
course_overview = CourseOverview.objects.get(id=course_idx.course_id)
6464
except CourseOverview.DoesNotExist:
6565
course_overview = None # Course exists in modulestore but details aren't cached into CourseOverview yet
66-
display_name: str = (course_overview.display_name if course_overview else None) or course_code
66+
title: str = (course_overview.display_name if course_overview else None) or course_code
6767

6868
# Determine the course language.
6969
# Note that in Studio, the options for course language generally came from the ALL_LANGUAGES setting, which is
@@ -93,9 +93,9 @@ def backfill_openedx_catalog(apps, schema_editor):
9393
org_id=org_data["id"],
9494
course_code=course_code,
9595
defaults={
96-
# The default display_name for the catalog course will be the same name as the newest run, since we
97-
# iterate over "all_course_runs" in "-pk" order (should be same as reverse chronological)
98-
"display_name": display_name,
96+
# The default title for the catalog course will be the same name as the newest run, since we iterate
97+
# over "all_course_runs" in "-pk" order (should be same as reverse chronological)
98+
"title": title,
9999
"language": language,
100100
},
101101
)
@@ -114,7 +114,7 @@ def backfill_openedx_catalog(apps, schema_editor):
114114
catalog_course=cc,
115115
run_code=run_code,
116116
course_key=course_idx.course_id,
117-
defaults={"display_name": display_name},
117+
defaults={"title": title},
118118
)
119119

120120
# Correct the "created" timestamp. Since it has auto_now_add=True, we can't set its value except using update()

openedx/core/djangoapps/content/course_overviews/signals.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ def _listen_for_course_publish(sender, course_key, **kwargs): # pylint: disable
5858
# Presumably this is a newly-created course. Create the CourseRun.
5959
course_run = catalog_api.create_course_run_for_modulestore_course_with(
6060
course_key=course_key,
61-
display_name=updated_course_overview.display_name,
61+
title=updated_course_overview.display_name,
6262
language_short=updated_course_overview.language,
6363
)
6464

6565
# Keep the CourseRun up to date as the course is edited:
66-
if updated_course_overview.display_name != course_run.display_name:
67-
catalog_api.sync_course_run_details(course_key, display_name=updated_course_overview.display_name)
68-
# If this course is the only run in the CatalogCourse, should we update the display_name of
69-
# the CatalogCourse to match the run's new name? Currently the only way to edit the name of
66+
if updated_course_overview.display_name != course_run.title:
67+
catalog_api.sync_course_run_details(course_key, title=updated_course_overview.display_name)
68+
# If this course is the only run in the CatalogCourse, should we update the title of
69+
# the CatalogCourse to match the run's new title? Currently the only way to edit the name of
7070
# a CatalogCourse is via the Django admin. But it's also not used anywhere yet.
7171

7272
if (

0 commit comments

Comments
 (0)