From d9e71004a014e6356cbfcc91612d934c449a3eb7 Mon Sep 17 00:00:00 2001 From: MueezKhan246 Date: Mon, 21 Oct 2024 15:05:30 +0500 Subject: [PATCH 1/7] fix: added content_title, progress_status in get_learner_data_records for derived classed (ENT 9516) --- integrated_channels/blackboard/exporters/learner_data.py | 4 ++++ integrated_channels/canvas/exporters/learner_data.py | 4 ++++ integrated_channels/cornerstone/exporters/learner_data.py | 4 ++++ integrated_channels/degreed2/exporters/learner_data.py | 4 ++++ integrated_channels/moodle/exporters/learner_data.py | 4 ++++ .../sap_success_factors/exporters/learner_data.py | 4 ++++ 6 files changed, 24 insertions(+) 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..0da7a18827 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, From 9f1aa95e7f2f394f8c70cb15c8031ce042eb13be Mon Sep 17 00:00:00 2001 From: MueezKhan246 Date: Mon, 21 Oct 2024 15:10:25 +0500 Subject: [PATCH 2/7] refactor: updated build version --- CHANGELOG.rst | 4 ++++ enterprise/__init__.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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" From 4566ad7f16125d74e30d93cb24955113a2bc3434 Mon Sep 17 00:00:00 2001 From: MueezKhan246 Date: Mon, 21 Oct 2024 20:51:52 +0500 Subject: [PATCH 3/7] test: fix test_retrieve_same_learner_data_record --- .../test_blackboard/test_exporters/test_learner_data.py | 5 ++++- .../test_canvas/test_exporters/test_learner_data.py | 5 ++++- .../test_cornerstone/test_exporters/test_learner_data.py | 5 ++++- .../test_degreed2/test_exporters/test_learner_data.py | 1 + .../test_moodle/test_exporters/test_learner_data.py | 5 ++++- .../test_exporters/test_learner_data.py | 4 +++- 6 files changed, 20 insertions(+), 5 deletions(-) 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..5a32e31c13 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 @@ -124,7 +124,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 = 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.save() 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( From 510864bb63f876f4e6055de365d0aa63bd68a3e3 Mon Sep 17 00:00:00 2001 From: MueezKhan246 Date: Mon, 21 Oct 2024 21:48:45 +0500 Subject: [PATCH 4/7] refactor: added missing whitespace --- integrated_channels/cornerstone/exporters/learner_data.py | 4 ++-- .../test_cornerstone/test_exporters/test_learner_data.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/integrated_channels/cornerstone/exporters/learner_data.py b/integrated_channels/cornerstone/exporters/learner_data.py index 0da7a18827..587fb7ca18 100644 --- a/integrated_channels/cornerstone/exporters/learner_data.py +++ b/integrated_channels/cornerstone/exporters/learner_data.py @@ -55,8 +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 + 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/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 5a32e31c13..ef91dd1d38 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 @@ -129,7 +129,10 @@ def test_retrieve_same_learner_data_record(self, mock_course_catalog_api): 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 From 8f26c23a4bd062299bf76df418064b3462668659 Mon Sep 17 00:00:00 2001 From: MueezKhan246 Date: Tue, 22 Oct 2024 00:10:07 +0500 Subject: [PATCH 5/7] test: updated test_get_learner_data_record --- .../test_cornerstone/test_exporters/test_learner_data.py | 6 ++++++ 1 file changed, 6 insertions(+) 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 ef91dd1d38..0a60ab7ec2 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 @@ -111,6 +115,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 == ( From 79c2bb8e435cf14d3901363fbf747567a8dd28ec Mon Sep 17 00:00:00 2001 From: MueezKhan246 Date: Tue, 22 Oct 2024 00:17:10 +0500 Subject: [PATCH 6/7] refactor: removing trailing comma --- .../test_cornerstone/test_exporters/test_learner_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 0a60ab7ec2..d4723c6b97 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 @@ -44,7 +44,7 @@ def setUp(self): self.course_id = 'course-v1:edX+DemoX+DemoCourse' self.course_key = 'edX+DemoX' self.progress_status = 'In Progress' - self.content_title='DemoX', + self.content_title='DemoX' self.enterprise_customer = factories.EnterpriseCustomerFactory( enable_audit_enrollment=True, enable_audit_data_reporting=True, From 6894ad8cebe7257494e1195ebacd1ce7f074ac44 Mon Sep 17 00:00:00 2001 From: MueezKhan246 Date: Tue, 22 Oct 2024 00:40:09 +0500 Subject: [PATCH 7/7] refactor: added missing whitespace around operator --- .../test_cornerstone/test_exporters/test_learner_data.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 d4723c6b97..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 @@ -44,7 +44,7 @@ def setUp(self): self.course_id = 'course-v1:edX+DemoX+DemoCourse' self.course_key = 'edX+DemoX' self.progress_status = 'In Progress' - self.content_title='DemoX' + self.content_title = 'DemoX' self.enterprise_customer = factories.EnterpriseCustomerFactory( enable_audit_enrollment=True, enable_audit_data_reporting=True, @@ -107,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