Skip to content

Commit

Permalink
Added log for learner data transmission (#1953)
Browse files Browse the repository at this point in the history
* refactor: adding log for learner data transmission
  • Loading branch information
MueezKhan246 authored Dec 2, 2023
1 parent b76813a commit a04e650
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
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.8.1"
__version__ = "4.8.2"
32 changes: 31 additions & 1 deletion integrated_channels/moodle/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down

0 comments on commit a04e650

Please sign in to comment.