Remove CourseOverview.get_from_id[s]_if_exists (#22918)
The functions `CourseOverview.get_from_id_if_exists` and `CourseOverview.get_from_ids if exists` are bug- prone, in that they do not go to the modulestore when a CourseOverview is out-of-date or uncached. The docstrings spell this out, but callers seem not to understand the implications. So, in this commit, we: * Remove both functions * Add `CourseOverview.get_from_ids` for almost-as-fast yet safer bulk-fetching of overviews * Update call sites to use `course_exists` or `get_from_ids` in place of the old functions. * Add tests for @verify_course_exists. This PR should specifically fix an issue where the program_enrollments API was breaking when the CourseOverview version was bumped. CR-1708
This commit is contained in:
@@ -900,7 +900,7 @@ class ProgramCourseEnrollmentOverviewView(
|
||||
is_active=True,
|
||||
)
|
||||
|
||||
overviews = CourseOverview.get_from_ids_if_exists(course_run_keys)
|
||||
overviews = CourseOverview.get_from_ids(course_run_keys)
|
||||
|
||||
course_run_resume_urls = get_resume_urls_for_enrollments(user, course_enrollments)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user