feat: set traverse pagination to False (#32269)
* For enrollment email task, while getting course uuid and owner data don't traverse the discovery endpoint. * Update log message
This commit is contained in:
@@ -469,9 +469,16 @@ def get_course_runs_for_course(course_uuid): # lint-amnesty, pylint: disable=mi
|
||||
return []
|
||||
|
||||
|
||||
def get_owners_for_course(course_uuid): # lint-amnesty, pylint: disable=missing-function-docstring
|
||||
def get_owners_for_course(course_uuid):
|
||||
"""
|
||||
Retrieves the course owner given a course uuid.
|
||||
|
||||
Arguments
|
||||
course_uuid (string): Course UUID
|
||||
"""
|
||||
if course_uuid is None:
|
||||
raise ValueError("missing course_uuid")
|
||||
return []
|
||||
|
||||
user, catalog_integration = check_catalog_integration_and_get_user(error_message_field='Owners')
|
||||
if user:
|
||||
cache_key = f"{catalog_integration.CACHE_KEY}.course.{course_uuid}.course_runs"
|
||||
@@ -483,6 +490,7 @@ def get_owners_for_course(course_uuid): # lint-amnesty, pylint: disable=missing
|
||||
api_client=get_catalog_api_client(user),
|
||||
base_api_url=get_catalog_api_base_url(),
|
||||
cache_key=cache_key if catalog_integration.is_cache_enabled else None,
|
||||
traverse_pagination=False,
|
||||
long_term_cache=True,
|
||||
many=False
|
||||
)
|
||||
@@ -503,7 +511,8 @@ def get_course_uuid_for_course(course_run_key):
|
||||
UUID: Course UUID and None if it was not retrieved.
|
||||
"""
|
||||
if course_run_key is None:
|
||||
raise ValueError("missing course_run_key")
|
||||
return None
|
||||
|
||||
user, catalog_integration = check_catalog_integration_and_get_user(error_message_field='Course UUID')
|
||||
if user:
|
||||
api_client = get_catalog_api_client(user)
|
||||
@@ -520,6 +529,7 @@ def get_course_uuid_for_course(course_run_key):
|
||||
cache_key=run_cache_key if catalog_integration.is_cache_enabled else None,
|
||||
long_term_cache=True,
|
||||
many=False,
|
||||
traverse_pagination=False,
|
||||
)
|
||||
|
||||
course_key_str = course_run_data.get('course', None)
|
||||
@@ -536,6 +546,7 @@ def get_course_uuid_for_course(course_run_key):
|
||||
cache_key=run_cache_key if catalog_integration.is_cache_enabled else None,
|
||||
long_term_cache=True,
|
||||
many=False,
|
||||
traverse_pagination=False,
|
||||
)
|
||||
uuid_str = data.get('uuid', None)
|
||||
if uuid_str:
|
||||
@@ -617,9 +628,10 @@ def get_course_run_details(course_run_key, fields):
|
||||
Returns:
|
||||
dict with language, start date, end date, and max_effort details about specified course run
|
||||
"""
|
||||
if course_run_key is None:
|
||||
raise ValueError("missing course_run_key")
|
||||
course_run_details = {}
|
||||
if course_run_key is None:
|
||||
return course_run_details
|
||||
|
||||
user, catalog_integration = check_catalog_integration_and_get_user(
|
||||
error_message_field=f'Data for course_run {course_run_key}'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user