diff --git a/common/djangoapps/entitlements/rest_api/v1/views.py b/common/djangoapps/entitlements/rest_api/v1/views.py index d8dbd29b2494..3ca538eb0e1b 100644 --- a/common/djangoapps/entitlements/rest_api/v1/views.py +++ b/common/djangoapps/entitlements/rest_api/v1/views.py @@ -556,8 +556,16 @@ def _process_revoke_and_downgrade_to_audit(self, course_entitlements, user_id, r if course_entitlement.enrollment_course_run is not None: entitled_course_ids.append(str(course_entitlement.enrollment_course_run.course_id)) + log.info('B2C_SUBSCRIPTIONS: Getting course completion status for user %s and entitled_course_ids %s', + user_id, + entitled_course_ids) awarded_cert_course_ids, is_exception = get_courses_completion_status(user_id, entitled_course_ids) + log.info('B2C_SUBSCRIPTIONS: Got course completion response %s for user %s and entitled_course_ids %s', + awarded_cert_course_ids, + user_id, + entitled_course_ids) + if is_exception: # Trigger the retry task asynchronously log.exception('B2C_SUBSCRIPTIONS: Exception occurred while getting course completion status for user %s ' @@ -568,6 +576,11 @@ def _process_revoke_and_downgrade_to_audit(self, course_entitlements, user_id, r entitled_course_ids, user_id)) return + log.info('B2C_SUBSCRIPTIONS: Starting revoke_entitlements_and_downgrade_courses_to_audit for user %s and ' + 'awarded_cert_course_ids %s and revocable_entitlement_uuids %s', + user_id, + awarded_cert_course_ids, + revocable_entitlement_uuids) revoke_entitlements_and_downgrade_courses_to_audit(course_entitlements, user_id, awarded_cert_course_ids, revocable_entitlement_uuids) diff --git a/common/djangoapps/entitlements/tasks.py b/common/djangoapps/entitlements/tasks.py index b6ba21b36114..b79f44dcfadb 100644 --- a/common/djangoapps/entitlements/tasks.py +++ b/common/djangoapps/entitlements/tasks.py @@ -177,6 +177,11 @@ def retry_revoke_subscriptions_verified_access(self, revocable_entitlement_uuids user_id, revocable_entitlement_uuids ) + log.info('B2C_SUBSCRIPTIONS: Starting revoke_entitlements_and_downgrade_courses_to_audit for user %s and ' + 'awarded_cert_course_ids %s and revocable_entitlement_uuids %s from retry task', + user_id, + awarded_cert_course_ids, + revocable_entitlement_uuids) revoke_entitlements_and_downgrade_courses_to_audit(course_entitlements, user_id, awarded_cert_course_ids, revocable_entitlement_uuids) else: diff --git a/common/djangoapps/entitlements/utils.py b/common/djangoapps/entitlements/utils.py index f098c4054156..037ee9a6e003 100644 --- a/common/djangoapps/entitlements/utils.py +++ b/common/djangoapps/entitlements/utils.py @@ -69,9 +69,10 @@ def revoke_entitlements_and_downgrade_courses_to_audit(course_entitlements, user """ log.info('B2C_SUBSCRIPTIONS: Starting revoke_entitlements_and_downgrade_courses_to_audit for ' - 'user: %s and course_entitlements_uuids: %s', + 'user: %s, course_entitlements_uuids: %s, awarded_cert_course_ids: %s', user_id, - revocable_entitlement_uuids) + revocable_entitlement_uuids, + awarded_cert_course_ids) for course_entitlement in course_entitlements: if course_entitlement.enrollment_course_run is None: if course_entitlement.expired_at is None: @@ -90,6 +91,7 @@ def revoke_entitlements_and_downgrade_courses_to_audit(course_entitlements, user user_id, course_id) log.info('B2C_SUBSCRIPTIONS: Completed revoke_entitlements_and_downgrade_courses_to_audit for ' - 'user: %s and course_entitlements_uuids %s', + 'user: %s, course_entitlements_uuids: %s, awarded_cert_course_ids: %s', user_id, - revocable_entitlement_uuids) + revocable_entitlement_uuids, + awarded_cert_course_ids) diff --git a/openedx/core/djangoapps/credentials/utils.py b/openedx/core/djangoapps/credentials/utils.py index 6208fa3caefa..893aba787189 100644 --- a/openedx/core/djangoapps/credentials/utils.py +++ b/openedx/core/djangoapps/credentials/utils.py @@ -150,10 +150,18 @@ def get_courses_completion_status(lms_user_id, course_run_ids): return [], True # Yes, This is course_credentials_data. The key is named status but # it contains all the courses data from credentials. + log.info("Course completion status response for lms_user_id [%s] for course_run_ids [%s] is [%s]", + lms_user_id, + course_run_ids, + course_completion_response) course_credentials_data = course_completion_response.get('status', []) if course_credentials_data is not None: filtered_records = [course_data['course_run']['key'] for course_data in course_credentials_data if course_data['course_run']['key'] in course_run_ids and course_data['status'] == settings.CREDENTIALS_COURSE_COMPLETION_STATE] + log.info("Filtered course completion status response for lms_user_id [%s] for course_run_ids [%s] is [%s]", + lms_user_id, + course_run_ids, + filtered_records) return filtered_records, False return [], False