I am going through the studio home page code but I can not find any pagination logic even though it has been mentioned that pagination can be toggled on the new studio home page.
This is the last call in the stack and as you can see we are always fetching all the courses here, the previous calls also make no attempt to paginate the studio home page.
def _accessible_courses_summary_iter(request, org=None):
"""
List all courses available to the logged in user by iterating through all the courses
Arguments:
request: the request object
org (string): if not None, this value will limit the courses returned. An empty
string will result in no courses, and otherwise only courses with the
specified org will be returned. The default value is None.
"""
def course_filter(course_summary):
"""
Filter out unusable and inaccessible courses
"""
# TODO remove this condition when templates purged from db
if course_summary.location.course == 'templates':
return False
return has_studio_read_access(request.user, course_summary.id)
enable_home_page_api_v2 = settings.FEATURES["ENABLE_HOME_PAGE_COURSE_API_V2"]
if org is not None:
courses_summary = [] if org == '' else CourseOverview.get_all_courses(orgs=[org])
elif enable_home_page_api_v2:
# If the new home page API is enabled, we should use the Django ORM to filter and order the courses
courses_summary = CourseOverview.get_all_courses()
else:
courses_summary = modulestore().get_course_summaries()
if enable_home_page_api_v2:
search_query, order, active_only, archived_only = get_query_params_if_present(request)
courses_summary = get_filtered_and_ordered_courses(
courses_summary,
active_only,
archived_only,
search_query,
order,
)
courses_summary = filter(course_filter, courses_summary)
in_process_course_actions = get_in_process_course_actions(request)
return courses_summary, in_process_course_actions
Can anyone explain to me if there is actually a pagination logic present as of now and where can I find it?
Thanks.
This was done as a new version of the API to prevent breaking the course-authoring MFE or having to deploy changes in two independently deployed applications at once.