From 32733e43cc329ab40a5078409b241cdf48205f47 Mon Sep 17 00:00:00 2001 From: Nathan Sprenkle Date: Tue, 25 Oct 2022 16:21:48 -0400 Subject: [PATCH] temp: added debug logging to init view (#31204) Also involved reordering some code into more logical groupings. --- lms/djangoapps/learner_home/views.py | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/lms/djangoapps/learner_home/views.py b/lms/djangoapps/learner_home/views.py index 7ff61cf02e..4a78bdbd35 100644 --- a/lms/djangoapps/learner_home/views.py +++ b/lms/djangoapps/learner_home/views.py @@ -370,15 +370,27 @@ class InitializeView(RetrieveAPIView): # pylint: disable=unused-argument """ Load information required for displaying the learner home """ + logger.info(f"Fetching platform-level data for {user.username}") + # Determine if user needs to confirm email account email_confirmation = get_user_account_confirmation_info(user) # Gather info for enterprise dashboard enterprise_customer = get_enterprise_customer(user, self.request, is_masquerade) + # Get site-wide social sharing config + social_share_settings = get_social_share_settings() + + # Get platform-level settings + platform_settings = get_platform_settings() + + logger.info(f"Finished fetching platform-level data for {user.username}") + # Get the org whitelist or the org blacklist for the current site site_org_whitelist, site_org_blacklist = get_org_black_and_whitelist_for_site() + logger.info(f"Fetching entitlements for {user.username}") + # Get entitlements and course overviews for serializing ( fulfilled_entitlements_by_course_key, @@ -390,11 +402,17 @@ class InitializeView(RetrieveAPIView): # pylint: disable=unused-argument unfulfilled_entitlement_pseudo_sessions ) + logger.info(f"Finished fetching entitlements for {user.username}") + logger.info(f"Fetching enrollments for {user.username}") + # Get enrollments course_enrollments, course_mode_info = get_enrollments( user, site_org_whitelist, site_org_blacklist ) + logger.info(f"Finished fetching enrollments for {user.username}") + logger.info(f"Fetching supporting info for {user.username}") + # Get email opt-outs for student show_email_settings_for, course_optouts = get_email_settings_info( user, course_enrollments @@ -419,13 +437,14 @@ class InitializeView(RetrieveAPIView): # pylint: disable=unused-argument suggested_courses = get_suggested_courses().get("courses", []) # Get social media sharing config - social_share_settings = get_social_share_settings() course_share_urls = get_course_share_urls(course_enrollments) + logger.info(f"Finished fetching supporting info for {user.username}") + learner_dash_data = { "emailConfirmation": email_confirmation, "enterpriseDashboard": enterprise_customer, - "platformSettings": get_platform_settings(), + "platformSettings": platform_settings, "enrollments": course_enrollments, "unfulfilledEntitlements": unfulfilled_entitlements, "socialShareSettings": social_share_settings, @@ -448,9 +467,14 @@ class InitializeView(RetrieveAPIView): # pylint: disable=unused-argument "programs": programs, } + logger.info(f"Serializing home info for {user.username}") + response_data = LearnerDashboardSerializer( learner_dash_data, context=context ).data + + logger.info(f"Finished serializing home info for {user.username}") + return Response(response_data)