diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a320801bca..e2a06efa4b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,6 +16,10 @@ Change Log Unreleased ---------- +[4.8.2] +-------- +refactor: adding log for learner data transmission + [4.8.1] -------- feat: integrated resumeCourseRunUrl into enrollments API diff --git a/enterprise/__init__.py b/enterprise/__init__.py index 9751b8fa4a..ad531fb9c8 100644 --- a/enterprise/__init__.py +++ b/enterprise/__init__.py @@ -2,4 +2,4 @@ Your project description goes here. """ -__version__ = "4.8.1" +__version__ = "4.8.2" diff --git a/integrated_channels/moodle/client.py b/integrated_channels/moodle/client.py index e444750789..9ab8233686 100644 --- a/integrated_channels/moodle/client.py +++ b/integrated_channels/moodle/client.py @@ -335,7 +335,37 @@ def _wrapped_create_course_completion(self, user_id, payload): 'grades[0][grade]': completion_data['grade'] * self.enterprise_configuration.grade_scale } - return self._post(params) + response = self._post(params) + + if hasattr(response, 'status_code'): + status_code = response.status_code + else: + status_code = None + + if hasattr(response, 'text'): + text = response.text + else: + text = None + + if hasattr(response, 'headers'): + headers = response.headers + else: + headers = None + + LOGGER.info( + 'Learner Data Transmission' + f'for course={completion_data["courseID"]} with data ' + f'source: {module_name}, ' + f'activityid: {course_module_id}, ' + f'grades[0][studentid]: {moodle_user_id}, ' + f'grades[0][grade]: {completion_data["grade"] * self.enterprise_configuration.grade_scale} ' + f' with response: {response} ' + f'Status Code: {status_code}, ' + f'Text: {text}, ' + f'Headers: {headers}, ' + ) + + return response def create_content_metadata(self, serialized_data): """