edx-enterprise-data 4.11.1__py3-none-any.whl → 5.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {edx_enterprise_data-4.11.1.dist-info → edx_enterprise_data-5.0.0.dist-info}/METADATA +1 -1
- {edx_enterprise_data-4.11.1.dist-info → edx_enterprise_data-5.0.0.dist-info}/RECORD +8 -8
- {edx_enterprise_data-4.11.1.dist-info → edx_enterprise_data-5.0.0.dist-info}/WHEEL +1 -1
- enterprise_data/__init__.py +1 -1
- enterprise_data/api/v1/views.py +28 -7
- enterprise_data/tests/api/v1/test_views.py +3 -3
- {edx_enterprise_data-4.11.1.dist-info → edx_enterprise_data-5.0.0.dist-info}/LICENSE +0 -0
- {edx_enterprise_data-4.11.1.dist-info → edx_enterprise_data-5.0.0.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
enterprise_data/__init__.py,sha256=
|
1
|
+
enterprise_data/__init__.py,sha256=9CalZxzrrlzN7gPjoqRg4WtrBoH9ajmbFp5PDXYl8wQ,224
|
2
2
|
enterprise_data/apps.py,sha256=aF6hZwDfI2oWj95tUTm_2ikHueQj-jLj-u0GrgzpsQI,414
|
3
3
|
enterprise_data/clients.py,sha256=GvQupy5TVYfO_IKC3yzXSAgNP54r-PtIjidM5ws9Iks,3947
|
4
4
|
enterprise_data/constants.py,sha256=pS65L4mimz7hd_cLml_mXdU0GJ7hs0X8UQ8MNjC5hCU,234
|
@@ -17,7 +17,7 @@ enterprise_data/api/v0/views.py,sha256=4RslZ4NZOU-844bnebEQ71ji2utRY7jEijqC45oQQ
|
|
17
17
|
enterprise_data/api/v1/__init__.py,sha256=4MKmD0y8ANRoaNzSYTwPFVCSfeid_bdzHCHnhR37MIs,144
|
18
18
|
enterprise_data/api/v1/serializers.py,sha256=iLkuaXLRaRkfVyXch__IKXA3OIUH63QUNNGpXOjWPTk,6674
|
19
19
|
enterprise_data/api/v1/urls.py,sha256=Vev34sBjvDSqGUuQQGTu-1ft-ISYUPO_GTOpx0RTiEA,1106
|
20
|
-
enterprise_data/api/v1/views.py,sha256=
|
20
|
+
enterprise_data/api/v1/views.py,sha256=7bGzQQO2CORVByKVORwhAIKhgjf1UMcTzz1VXmMXaTs,21475
|
21
21
|
enterprise_data/fixtures/enterprise_enrollment.json,sha256=6onPXXR29pMdTdbl_mn81sDi3Re5jkLUZz2TPMB_1IY,5786
|
22
22
|
enterprise_data/fixtures/enterprise_user.json,sha256=6g8GvNY9j_fh1dvAU80bTAMI2F5vXCkb8a4UjsftMvQ,1970
|
23
23
|
enterprise_data/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -85,7 +85,7 @@ enterprise_data/tests/api/v0/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
|
|
85
85
|
enterprise_data/tests/api/v0/test_serializers.py,sha256=Gfty6gy6OQLN318uL1OCPhAZOqSUL50FWc0nC23VMnc,6257
|
86
86
|
enterprise_data/tests/api/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
87
87
|
enterprise_data/tests/api/v1/test_serializers.py,sha256=DwgEHcyOP3oqNUPB2O-NkJGeO_cYs9XJiq7791vJLZE,3682
|
88
|
-
enterprise_data/tests/api/v1/test_views.py,sha256=
|
88
|
+
enterprise_data/tests/api/v1/test_views.py,sha256=rLqUHfar0HdBNtz33hQxd_0qUUgr7Ku3KwQSQ1B4Ypg,15213
|
89
89
|
enterprise_data_roles/__init__.py,sha256=toCpbypm2uDoWVw29_em9gPFNly8vNUS__C0b4TCqEg,112
|
90
90
|
enterprise_data_roles/admin.py,sha256=QNP0VeWE092vZzpyxOA5UJK1nNGl5e71B1J0RCwo_nU,998
|
91
91
|
enterprise_data_roles/apps.py,sha256=nKi8TyuQ5Q6WGtKs5QeXvUTc3N-YQjKhyBnm2EM3Bng,260
|
@@ -126,8 +126,8 @@ enterprise_reporting/tests/test_send_enterprise_reports.py,sha256=WtL-RqGgu2x5PP
|
|
126
126
|
enterprise_reporting/tests/test_utils.py,sha256=7Y5GmeibiC8Q5kIpYuIAkFpeyIDRs2U3ItxsabhR1zM,9493
|
127
127
|
enterprise_reporting/tests/test_vertica_client.py,sha256=-R2yNCGUjRtoXwLMBloVFQkFYrJoo613VCr61gwI3kQ,140
|
128
128
|
enterprise_reporting/tests/utils.py,sha256=xms2LM7DV3wczXEfctOK1ddel1EE0J_YSr17UzbCDy4,1401
|
129
|
-
edx_enterprise_data-
|
130
|
-
edx_enterprise_data-
|
131
|
-
edx_enterprise_data-
|
132
|
-
edx_enterprise_data-
|
133
|
-
edx_enterprise_data-
|
129
|
+
edx_enterprise_data-5.0.0.dist-info/LICENSE,sha256=dql8h4yceoMhuzlcK0TT_i-NgTFNIZsgE47Q4t3dUYI,34520
|
130
|
+
edx_enterprise_data-5.0.0.dist-info/METADATA,sha256=Lz8YW4ZkYhWJk6llJM1aMlVYR9vb5MiR6nk_R8DxB-o,1489
|
131
|
+
edx_enterprise_data-5.0.0.dist-info/WHEEL,sha256=AtBG6SXL3KF_v0NxLf0ehyVOh0cold-JbJYXNGorC6Q,92
|
132
|
+
edx_enterprise_data-5.0.0.dist-info/top_level.txt,sha256=f5F2kU-dob6MqiHJpgZkFzoCD5VMhsdpkTV5n9Tvq3I,59
|
133
|
+
edx_enterprise_data-5.0.0.dist-info/RECORD,,
|
enterprise_data/__init__.py
CHANGED
enterprise_data/api/v1/views.py
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
Views for enterprise api v1.
|
3
3
|
"""
|
4
4
|
|
5
|
-
|
6
5
|
from datetime import date, timedelta
|
7
6
|
from logging import getLogger
|
7
|
+
from uuid import UUID
|
8
8
|
|
9
9
|
from django_filters.rest_framework import DjangoFilterBackend
|
10
10
|
from edx_django_utils.cache import TieredCache
|
@@ -181,7 +181,7 @@ class EnterpriseLearnerEnrollmentViewSet(EnterpriseViewSetMixin, viewsets.ReadOn
|
|
181
181
|
|
182
182
|
offer_id = query_filters.get('offer_id')
|
183
183
|
if offer_id:
|
184
|
-
queryset =
|
184
|
+
queryset = self.filter_by_offer_id(queryset, offer_id)
|
185
185
|
|
186
186
|
ignore_null_course_list_price = query_filters.get('ignore_null_course_list_price')
|
187
187
|
if ignore_null_course_list_price:
|
@@ -197,6 +197,27 @@ class EnterpriseLearnerEnrollmentViewSet(EnterpriseViewSetMixin, viewsets.ReadOn
|
|
197
197
|
|
198
198
|
return queryset
|
199
199
|
|
200
|
+
def filter_by_offer_id(self, queryset, offer_id):
|
201
|
+
"""
|
202
|
+
Filter queryset by `offer_id`
|
203
|
+
"""
|
204
|
+
# offer_id field in table contains two types of data
|
205
|
+
# 1. integer
|
206
|
+
# 2. uuid
|
207
|
+
# In table, uuids are stored without hyphen and in lower case
|
208
|
+
# but api clients are sending uuids with hyphen and that causes the issue
|
209
|
+
# we need to remove the hyphens from uuid, convert the uuid to lower case and then do a compare in DB
|
210
|
+
|
211
|
+
# if offer_id is a uuid only then do the transformation
|
212
|
+
try:
|
213
|
+
offer_id_uuid_obj = UUID(offer_id, version=4)
|
214
|
+
offer_id = str(offer_id_uuid_obj)
|
215
|
+
offer_id = offer_id.replace('-', '')
|
216
|
+
except ValueError:
|
217
|
+
pass
|
218
|
+
|
219
|
+
return queryset.filter(offer_id=offer_id)
|
220
|
+
|
200
221
|
def filter_active_enrollments(self, queryset):
|
201
222
|
"""
|
202
223
|
Filters queryset to include enrollments with course date in future
|
@@ -471,7 +492,7 @@ class EnterpriseAdminInsightsView(APIView):
|
|
471
492
|
"""
|
472
493
|
response_data = {}
|
473
494
|
learner_progress = {}
|
474
|
-
|
495
|
+
learner_engagement = {}
|
475
496
|
|
476
497
|
try:
|
477
498
|
learner_progress = EnterpriseAdminLearnerProgress.objects.get(enterprise_customer_uuid=enterprise_id)
|
@@ -481,14 +502,14 @@ class EnterpriseAdminInsightsView(APIView):
|
|
481
502
|
pass
|
482
503
|
|
483
504
|
try:
|
484
|
-
|
485
|
-
|
486
|
-
response_data['
|
505
|
+
learner_engagement = EnterpriseAdminSummarizeInsights.objects.get(enterprise_customer_uuid=enterprise_id)
|
506
|
+
learner_engagement = serializers.EnterpriseAdminSummarizeInsightsSerializer(learner_engagement).data
|
507
|
+
response_data['learner_engagement'] = learner_engagement
|
487
508
|
except EnterpriseAdminSummarizeInsights.DoesNotExist:
|
488
509
|
pass
|
489
510
|
|
490
511
|
status = HTTP_200_OK
|
491
|
-
if learner_progress == {} and
|
512
|
+
if learner_progress == {} and learner_engagement == {}:
|
492
513
|
status = HTTP_404_NOT_FOUND
|
493
514
|
|
494
515
|
return Response(data=response_data, status=status)
|
@@ -338,7 +338,7 @@ class TestEnterpriseAdminInsightsView(JWTTestMixin, APITransactionTestCase):
|
|
338
338
|
learner_progress_obj = EnterpriseAdminLearnerProgressFactory.create(
|
339
339
|
enterprise_customer_uuid=enterprise_customer_uuid
|
340
340
|
)
|
341
|
-
|
341
|
+
learner_engagement_obj = EnterpriseAdminSummarizeInsightsFactory.create(
|
342
342
|
enterprise_customer_uuid=enterprise_customer_uuid
|
343
343
|
)
|
344
344
|
|
@@ -350,8 +350,8 @@ class TestEnterpriseAdminInsightsView(JWTTestMixin, APITransactionTestCase):
|
|
350
350
|
|
351
351
|
learner_progress = response_json['learner_progress']
|
352
352
|
self.verify_data(learner_progress, learner_progress_obj)
|
353
|
-
|
354
|
-
self.verify_data(
|
353
|
+
learner_engagement = response_json['learner_engagement']
|
354
|
+
self.verify_data(learner_engagement, learner_engagement_obj)
|
355
355
|
|
356
356
|
def test_retrieve_enterprise_admin_insights_no_data(self):
|
357
357
|
"""
|
File without changes
|
File without changes
|