Skip to content

Commit

Permalink
feat: add logging to debug SAP SF transmission issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sameeramin committed Sep 13, 2024
1 parent 1745b40 commit 66228b8
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Unreleased
----------
* nothing unreleased

[4.25.13]
----------
* feat: add logging to debug SAP SuccessFactors transmission issues

[4.25.12]
----------
* feat: add username query to enterprise customer user query
Expand Down
2 changes: 1 addition & 1 deletion enterprise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Your project description goes here.
"""

__version__ = "4.25.12"
__version__ = "4.25.13"
42 changes: 42 additions & 0 deletions integrated_channels/integrated_channel/exporters/learner_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
LOGGER = getLogger(__name__)
User = auth.get_user_model()

SAPSF_CUST_UUID = 'bb39ffc3-3ab1-41aa-87bb-9814c9de6f82'


class LearnerExporter(ChannelSettingsMixin, Exporter):
"""
Expand Down Expand Up @@ -124,6 +126,16 @@ def bulk_assessment_level_export(self):
# Create a record of each subsection from every enterprise enrollment
for enterprise_enrollment in enrollment_queryset:
if not LearnerExporter.has_data_sharing_consent(enterprise_enrollment):
# Adding logging to debug the issue we are having with a customer using SAPSF channel
if self.enterprise_customer.uuid == SAPSF_CUST_UUID:
LOGGER.info(generate_formatted_log(

Check warning on line 131 in integrated_channels/integrated_channel/exporters/learner_data.py

View check run for this annotation

Codecov / codecov/patch

integrated_channels/integrated_channel/exporters/learner_data.py#L131

Added line #L131 was not covered by tests
self.enterprise_configuration.channel_code(),
self.enterprise_configuration.enterprise_customer.uuid,
None,
None,
f'[SAPSF] Transmission skipped for {enterprise_enrollment.enterprise_customer_user.user_id}'
'due to missing data sharing consent.'
))
continue

assessment_grade_data = self._collect_assessment_grades_data(enterprise_enrollment)
Expand Down Expand Up @@ -192,6 +204,17 @@ def single_assessment_level_export(self, **kwargs):
detect_grade_updated=self.INCLUDE_GRADE_FOR_COMPLETION_AUDIT_CHECK,
)

# Adding logging to debug the issue we are having with a customer using SAPSF channel
if self.enterprise_customer.uuid == SAPSF_CUST_UUID:
LOGGER.info(generate_formatted_log(

Check warning on line 209 in integrated_channels/integrated_channel/exporters/learner_data.py

View check run for this annotation

Codecov / codecov/patch

integrated_channels/integrated_channel/exporters/learner_data.py#L209

Added line #L209 was not covered by tests
self.enterprise_configuration.channel_code(),
self.enterprise_configuration.enterprise_customer.uuid,
None,
None,
f'[SAPSF] Transmission already sent for {enterprise_enrollment.enterprise_customer_user.user_id}'
f'is_already_transmitted returned {already_transmitted}'
))

if not (TransmissionAudit and already_transmitted) and LearnerExporter.has_data_sharing_consent(
enterprise_enrollment):

Expand All @@ -202,6 +225,15 @@ def single_assessment_level_export(self, **kwargs):
assessment_grade_data=assessment_grade_data,
)
if records:
# Adding logging to debug the issue we are having with a customer using SAPSF channel
if self.enterprise_customer.uuid == SAPSF_CUST_UUID:
LOGGER.info(generate_formatted_log(

Check warning on line 230 in integrated_channels/integrated_channel/exporters/learner_data.py

View check run for this annotation

Codecov / codecov/patch

integrated_channels/integrated_channel/exporters/learner_data.py#L230

Added line #L230 was not covered by tests
self.enterprise_configuration.channel_code(),
self.enterprise_configuration.enterprise_customer.uuid,
None,
None,
f'[SAPSF] Transmission sent for {enterprise_enrollment.enterprise_customer_user.user_id}'
))
# There are some cases where we won't receive a record from the above
# method; right now, that should only happen if we have an Enterprise-linked
# user for the integrated channel, and transmission of that user's
Expand Down Expand Up @@ -497,6 +529,16 @@ def _filter_out_pre_transmitted_enrollments(
grade,
detect_grade_updated=self.INCLUDE_GRADE_FOR_COMPLETION_AUDIT_CHECK,
):
# Adding logging to debug the issue we are having with a customer using SAPSF channel
if self.enterprise_customer.uuid == SAPSF_CUST_UUID:
LOGGER.info(generate_formatted_log(

Check warning on line 534 in integrated_channels/integrated_channel/exporters/learner_data.py

View check run for this annotation

Codecov / codecov/patch

integrated_channels/integrated_channel/exporters/learner_data.py#L534

Added line #L534 was not covered by tests
self.enterprise_configuration.channel_code(),
self.enterprise_configuration.enterprise_customer.uuid,
None,
None,
f'[SAPSF] Transmission skipped for {enterprise_enrollment.enterprise_customer_user.user_id}'
'transmission_audit and already_transmitted returned True.'
))
# We've already sent a completion status for this enrollment
LOGGER.info(generate_formatted_log(
channel_name, enterprise_customer_uuid, lms_user_id, course_id,
Expand Down

0 comments on commit 66228b8

Please sign in to comment.