From 08b5e559bfd97946dadcca1d02709a40f7f5f358 Mon Sep 17 00:00:00 2001 From: MueezKhan246 <93375917+MueezKhan246@users.noreply.github.com> Date: Tue, 22 Oct 2024 01:12:42 +0500 Subject: [PATCH] Added content_title, progress_status in get_learner_data_records for derived classed (#2267) * fix: added content_title, progress_status in get_learner_data_records for derived classed (ENT 9516) --- CHANGELOG.rst | 4 ++++ enterprise/__init__.py | 2 +- .../blackboard/exporters/learner_data.py | 4 ++++ .../canvas/exporters/learner_data.py | 4 ++++ .../cornerstone/exporters/learner_data.py | 4 ++++ .../degreed2/exporters/learner_data.py | 4 ++++ .../moodle/exporters/learner_data.py | 4 ++++ .../exporters/learner_data.py | 4 ++++ .../test_exporters/test_learner_data.py | 5 ++++- .../test_exporters/test_learner_data.py | 5 ++++- .../test_exporters/test_learner_data.py | 18 ++++++++++++++++-- .../test_exporters/test_learner_data.py | 1 + .../test_exporters/test_learner_data.py | 5 ++++- .../test_exporters/test_learner_data.py | 4 +++- 14 files changed, 61 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 77b3b8154b..9809873134 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -17,6 +17,10 @@ Unreleased ---------- * nothing unreleased +[4.28.2] +-------- +* fix: added content_title, progress_status in get_learner_data_records for derived classed of learner data exporters. + [4.28.1] -------- * feat: making to-be-deleted model field nullable diff --git a/enterprise/__init__.py b/enterprise/__init__.py index 49318e874b..8d04af17d9 100644 --- a/enterprise/__init__.py +++ b/enterprise/__init__.py @@ -2,4 +2,4 @@ Your project description goes here. """ -__version__ = "4.28.1" +__version__ = "4.28.2" diff --git a/integrated_channels/blackboard/exporters/learner_data.py b/integrated_channels/blackboard/exporters/learner_data.py index 1d636245d2..aeabb4baf5 100644 --- a/integrated_channels/blackboard/exporters/learner_data.py +++ b/integrated_channels/blackboard/exporters/learner_data.py @@ -22,6 +22,8 @@ def get_learner_data_records( self, enterprise_enrollment, completed_date=None, + content_title=None, + progress_status=None, course_completed=False, **kwargs ): # pylint: disable=arguments-differ @@ -65,6 +67,8 @@ def get_learner_data_records( course_completed=course_completed, grade=percent_grade, completed_timestamp=completed_date, + content_title=content_title, + progress_status=progress_status, blackboard_completed_timestamp=blackboard_completed_timestamp, enterprise_customer_uuid=enterprise_customer_user.enterprise_customer.uuid, plugin_configuration_id=self.enterprise_configuration.id, diff --git a/integrated_channels/canvas/exporters/learner_data.py b/integrated_channels/canvas/exporters/learner_data.py index f3f172b265..cf5ac94393 100644 --- a/integrated_channels/canvas/exporters/learner_data.py +++ b/integrated_channels/canvas/exporters/learner_data.py @@ -23,6 +23,8 @@ def get_learner_data_records( self, enterprise_enrollment, completed_date=None, + content_title=None, + progress_status=None, course_completed=False, **kwargs ): # pylint: disable=arguments-differ @@ -65,6 +67,8 @@ def get_learner_data_records( course_completed=course_completed, grade=percent_grade, completed_timestamp=completed_date, + content_title=content_title, + progress_status=progress_status, canvas_completed_timestamp=canvas_completed_timestamp, enterprise_customer_uuid=enterprise_customer_user.enterprise_customer.uuid, plugin_configuration_id=self.enterprise_configuration.id, diff --git a/integrated_channels/cornerstone/exporters/learner_data.py b/integrated_channels/cornerstone/exporters/learner_data.py index 99ab1e7c2c..587fb7ca18 100644 --- a/integrated_channels/cornerstone/exporters/learner_data.py +++ b/integrated_channels/cornerstone/exporters/learner_data.py @@ -23,6 +23,8 @@ def get_learner_data_records( enterprise_enrollment, completed_date=None, grade=None, + content_title=None, + progress_status=None, course_completed=False, **kwargs, ): # pylint: disable=arguments-differ @@ -53,6 +55,8 @@ def get_learner_data_records( csod_learner_data_transmission.grade = grade csod_learner_data_transmission.course_completed = course_completed csod_learner_data_transmission.completed_timestamp = completed_date + csod_learner_data_transmission.content_title = content_title + csod_learner_data_transmission.progress_status = progress_status # Used for api error reporting csod_learner_data_transmission.user_email = enterprise_enrollment.enterprise_customer_user.user_email diff --git a/integrated_channels/degreed2/exporters/learner_data.py b/integrated_channels/degreed2/exporters/learner_data.py index 5b3750dff5..f638ef81a8 100644 --- a/integrated_channels/degreed2/exporters/learner_data.py +++ b/integrated_channels/degreed2/exporters/learner_data.py @@ -24,6 +24,8 @@ def get_learner_data_records( self, enterprise_enrollment, completed_date=None, + content_title=None, + progress_status=None, course_completed=False, **kwargs ): # pylint: disable=arguments-differ @@ -70,6 +72,8 @@ def get_learner_data_records( user_email=enterprise_enrollment.enterprise_customer_user.user_email, course_id=get_course_id_for_enrollment(enterprise_enrollment), completed_timestamp=completed_date, + content_title=content_title, + progress_status=progress_status, degreed_completed_timestamp=degreed_completed_timestamp, course_completed=course_completed, grade=percent_grade, diff --git a/integrated_channels/moodle/exporters/learner_data.py b/integrated_channels/moodle/exporters/learner_data.py index df1ad82bec..2f6c3cef38 100644 --- a/integrated_channels/moodle/exporters/learner_data.py +++ b/integrated_channels/moodle/exporters/learner_data.py @@ -22,6 +22,8 @@ def get_learner_data_records( self, enterprise_enrollment, completed_date=None, + content_title=None, + progress_status=None, course_completed=False, **kwargs ): # pylint: disable=arguments-differ @@ -67,6 +69,8 @@ def get_learner_data_records( course_completed=course_completed, grade=percent_grade, completed_timestamp=completed_date, + content_title=content_title, + progress_status=progress_status, moodle_completed_timestamp=moodle_completed_timestamp, enterprise_customer_uuid=enterprise_customer_user.enterprise_customer.uuid, plugin_configuration_id=self.enterprise_configuration.id, diff --git a/integrated_channels/sap_success_factors/exporters/learner_data.py b/integrated_channels/sap_success_factors/exporters/learner_data.py index acc7a52fa1..040852b3e8 100644 --- a/integrated_channels/sap_success_factors/exporters/learner_data.py +++ b/integrated_channels/sap_success_factors/exporters/learner_data.py @@ -31,6 +31,8 @@ def get_learner_data_records( enterprise_enrollment, completed_date=None, grade=None, + content_title=None, + progress_status=None, course_completed=False, **kwargs, ): # pylint: disable=arguments-differ @@ -74,6 +76,8 @@ def get_learner_data_records( completed_timestamp=completed_date, sap_completed_timestamp=sap_completed_timestamp, grade=grade, + content_title=content_title, + progress_status=progress_status, total_hours=total_hours, credit_hours=total_hours, enterprise_customer_uuid=self.enterprise_configuration.enterprise_customer.uuid, diff --git a/tests/test_integrated_channels/test_blackboard/test_exporters/test_learner_data.py b/tests/test_integrated_channels/test_blackboard/test_exporters/test_learner_data.py index 5db1387af3..3313a5d413 100644 --- a/tests/test_integrated_channels/test_blackboard/test_exporters/test_learner_data.py +++ b/tests/test_integrated_channels/test_blackboard/test_exporters/test_learner_data.py @@ -65,7 +65,10 @@ def test_retrieve_same_learner_data_record(self, mock_course_catalog_api): ) mock_course_catalog_api.return_value.get_course_id.return_value = self.course_key exporter = BlackboardLearnerExporter('fake-user', self.config) - learner_data_records_1 = exporter.get_learner_data_records(enterprise_course_enrollment)[0] + learner_data_records_1 = exporter.get_learner_data_records( + enterprise_course_enrollment, + progress_status='In Progress' + )[0] learner_data_records_1.save() learner_data_records_2 = exporter.get_learner_data_records(enterprise_course_enrollment)[0] learner_data_records_2.save() diff --git a/tests/test_integrated_channels/test_canvas/test_exporters/test_learner_data.py b/tests/test_integrated_channels/test_canvas/test_exporters/test_learner_data.py index 7a97f4859f..987e1dc005 100644 --- a/tests/test_integrated_channels/test_canvas/test_exporters/test_learner_data.py +++ b/tests/test_integrated_channels/test_canvas/test_exporters/test_learner_data.py @@ -73,7 +73,10 @@ def test_retrieve_same_learner_data_record(self, mock_course_catalog_api): """ mock_course_catalog_api.return_value.get_course_id.return_value = self.course_key exporter = CanvasLearnerExporter('fake-user', self.config) - learner_data_records_1 = exporter.get_learner_data_records(self.enterprise_course_enrollment)[0] + learner_data_records_1 = exporter.get_learner_data_records( + self.enterprise_course_enrollment, + progress_status='In Progress' + )[0] learner_data_records_1.save() learner_data_records_2 = exporter.get_learner_data_records(self.enterprise_course_enrollment)[0] learner_data_records_2.save() diff --git a/tests/test_integrated_channels/test_cornerstone/test_exporters/test_learner_data.py b/tests/test_integrated_channels/test_cornerstone/test_exporters/test_learner_data.py index 6f8ea97ea6..fea741cdb5 100644 --- a/tests/test_integrated_channels/test_cornerstone/test_exporters/test_learner_data.py +++ b/tests/test_integrated_channels/test_cornerstone/test_exporters/test_learner_data.py @@ -43,6 +43,8 @@ def setUp(self): self.user_guid = "fake-guid" self.course_id = 'course-v1:edX+DemoX+DemoCourse' self.course_key = 'edX+DemoX' + self.progress_status = 'In Progress' + self.content_title = 'DemoX' self.enterprise_customer = factories.EnterpriseCustomerFactory( enable_audit_enrollment=True, enable_audit_data_reporting=True, @@ -89,6 +91,8 @@ def _setup_enterprise_enrollment(self, user, course_id, course_key): callback_url=self.callback_url, subdomain=self.subdomain, course_id=course_key, + progress_status=self.progress_status, + content_title=self.content_title, user_guid=self.user_guid ) return enterprise_course_enrollment @@ -103,6 +107,8 @@ def test_get_learner_data_record(self, completed_date): learner_data_records = exporter.get_learner_data_records( self.enterprise_course_enrollment, completed_date=completed_date, + progress_status=self.progress_status, + content_title=self.content_title, course_completed=True, ) assert learner_data_records[0].course_id == self.course_key @@ -111,6 +117,8 @@ def test_get_learner_data_record(self, completed_date): assert learner_data_records[0].subdomain == self.subdomain assert learner_data_records[0].callback_url == self.callback_url assert learner_data_records[0].session_token == self.session_token + assert learner_data_records[0].progress_status == self.progress_status + assert learner_data_records[0].content_title == self.content_title assert learner_data_records[0].course_completed assert learner_data_records[0].enterprise_course_enrollment_id == self.enterprise_course_enrollment.id assert learner_data_records[0].completed_timestamp == ( @@ -124,9 +132,15 @@ def test_retrieve_same_learner_data_record(self, mock_course_catalog_api): """ mock_course_catalog_api.return_value.get_course_id.return_value = self.course_key exporter = CornerstoneLearnerExporter('fake-user', self.config) - learner_data_records_1 = exporter.get_learner_data_records(self.enterprise_course_enrollment)[0] + learner_data_records_1 = exporter.get_learner_data_records( + self.enterprise_course_enrollment, + progress_status='In Progress' + )[0] learner_data_records_1.save() - learner_data_records_2 = exporter.get_learner_data_records(self.enterprise_course_enrollment)[0] + learner_data_records_2 = exporter.get_learner_data_records( + self.enterprise_course_enrollment, + progress_status='In Progress' + )[0] learner_data_records_2.save() assert learner_data_records_1.id == learner_data_records_2.id diff --git a/tests/test_integrated_channels/test_degreed2/test_exporters/test_learner_data.py b/tests/test_integrated_channels/test_degreed2/test_exporters/test_learner_data.py index dba7de8bbd..23815e5245 100644 --- a/tests/test_integrated_channels/test_degreed2/test_exporters/test_learner_data.py +++ b/tests/test_integrated_channels/test_degreed2/test_exporters/test_learner_data.py @@ -124,6 +124,7 @@ def test_retrieve_same_learner_data_record(self): exporter = Degreed2LearnerExporter('fake-user', self.config) learner_data_records_1 = exporter.get_learner_data_records( enterprise_course_enrollment, + progress_status='In Progress' )[0] learner_data_records_1.save() learner_data_records_2 = exporter.get_learner_data_records( diff --git a/tests/test_integrated_channels/test_moodle/test_exporters/test_learner_data.py b/tests/test_integrated_channels/test_moodle/test_exporters/test_learner_data.py index 4b7da52c16..5fe9476c53 100644 --- a/tests/test_integrated_channels/test_moodle/test_exporters/test_learner_data.py +++ b/tests/test_integrated_channels/test_moodle/test_exporters/test_learner_data.py @@ -76,7 +76,10 @@ def test_retrieve_same_learner_data_record(self, mock_course_catalog_api): ) mock_course_catalog_api.return_value.get_course_id.return_value = self.course_key exporter = MoodleLearnerExporter('fake-user', self.config) - learner_data_records_1 = exporter.get_learner_data_records(enterprise_course_enrollment)[0] + learner_data_records_1 = exporter.get_learner_data_records( + enterprise_course_enrollment, + progress_status='In Progress' + )[0] learner_data_records_1.save() learner_data_records_2 = exporter.get_learner_data_records(enterprise_course_enrollment)[0] learner_data_records_2.save() diff --git a/tests/test_integrated_channels/test_sap_success_factors/test_exporters/test_learner_data.py b/tests/test_integrated_channels/test_sap_success_factors/test_exporters/test_learner_data.py index ae1d58ec2b..f946d8da93 100644 --- a/tests/test_integrated_channels/test_sap_success_factors/test_exporters/test_learner_data.py +++ b/tests/test_integrated_channels/test_sap_success_factors/test_exporters/test_learner_data.py @@ -120,6 +120,7 @@ def test_retrieve_same_learner_data_record( user = UserFactory() completed_date = None grade = 'Pass' + progress_status = 'Passed' course_completed = False enterprise_enrollment = EnterpriseCourseEnrollmentFactory( enterprise_customer_user=self.enterprise_customer_user @@ -130,7 +131,8 @@ def test_retrieve_same_learner_data_record( enterprise_enrollment, completed_date, grade, - course_completed + course_completed, + progress_status )[0] learner_data_records_1.save() learner_data_records_2 = exporter.get_learner_data_records(