edx-enterprise-data 4.11.1__py3-none-any.whl → 4.11.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: edx-enterprise-data
3
- Version: 4.11.1
3
+ Version: 4.11.2
4
4
  Summary: Enterprise Reporting
5
5
  Home-page: https://github.com/openedx/edx-enterprise-data
6
6
  Author: edX
@@ -1,4 +1,4 @@
1
- enterprise_data/__init__.py,sha256=rYT7H9pEm0bjdfRQ5Sdbtq678rQ1BoDMVRYzJis1TFo,225
1
+ enterprise_data/__init__.py,sha256=J1F3IYlsZp1T2MWENx0TWqIMpbl86OmjO6nUtuZqyWs,225
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=bgDzbw8GpzFWfVSGg-AonIvTBg2HM776fBFr2sJO2wI,20563
20
+ enterprise_data/api/v1/views.py,sha256=a5aIoIXoEExHX91440TUqzI-7EO-S0_-I5ZIU7GjH0c,21398
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
@@ -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-4.11.1.dist-info/LICENSE,sha256=dql8h4yceoMhuzlcK0TT_i-NgTFNIZsgE47Q4t3dUYI,34520
130
- edx_enterprise_data-4.11.1.dist-info/METADATA,sha256=uErWJheUKOikIg83Sl9Bhzo0cJVwZK8kCpstii3fD1A,1490
131
- edx_enterprise_data-4.11.1.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
132
- edx_enterprise_data-4.11.1.dist-info/top_level.txt,sha256=f5F2kU-dob6MqiHJpgZkFzoCD5VMhsdpkTV5n9Tvq3I,59
133
- edx_enterprise_data-4.11.1.dist-info/RECORD,,
129
+ edx_enterprise_data-4.11.2.dist-info/LICENSE,sha256=dql8h4yceoMhuzlcK0TT_i-NgTFNIZsgE47Q4t3dUYI,34520
130
+ edx_enterprise_data-4.11.2.dist-info/METADATA,sha256=mRAQGn1w8rYH-R8ZvH1dN1W5YJtksGkB5qen-w2ZD04,1490
131
+ edx_enterprise_data-4.11.2.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
132
+ edx_enterprise_data-4.11.2.dist-info/top_level.txt,sha256=f5F2kU-dob6MqiHJpgZkFzoCD5VMhsdpkTV5n9Tvq3I,59
133
+ edx_enterprise_data-4.11.2.dist-info/RECORD,,
@@ -2,6 +2,6 @@
2
2
  Enterprise data api application. This Django app exposes API endpoints used by enterprises.
3
3
  """
4
4
 
5
- __version__ = "4.11.1"
5
+ __version__ = "4.11.2"
6
6
 
7
7
  default_app_config = "enterprise_data.apps.EnterpriseDataAppConfig" # pylint: disable=invalid-name
@@ -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 = queryset.filter(offer_id=offer_id)
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