Skip to content

Commit

Permalink
Merge branch 'master' into bilalqamar95/node-v20-upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
BilalQamar95 authored Sep 27, 2024
2 parents 5b83379 + fb8f364 commit 61100ed
Show file tree
Hide file tree
Showing 25 changed files with 163 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/mysql8-migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-20.04 ]
os: [ ubuntu-latest ]
python-version: [ 3.8 ]

steps:
Expand Down
22 changes: 21 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,26 @@ Unreleased
----------
* nothing unreleased

[4.25.17]
---------
* feat: add pagination to the support tool customer list

[4.25.16]
---------
* feat: add a waffle flag for enterprise groups v2 feature

[4.25.15]
---------
* fix: Don't import HttpClientError from edx-rest-api-client

[4.25.14]
---------
* This version was incorretly tagged and so wasn't properly released.

[4.25.13]
----------
* feat: add logging to debug SAP SuccessFactors transmission issues

[4.25.12]
----------
* feat: add username query to enterprise customer user query
Expand Down Expand Up @@ -253,7 +273,7 @@ Unreleased

[4.20.7]
--------
* fix: add name from profile to group membership details
* fix: add name from profile to group membership details

[4.20.6]
--------
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.25.12"
__version__ = "4.25.17"
2 changes: 1 addition & 1 deletion enterprise/api/v1/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
from collections.abc import Iterable

import pytz
from edx_rest_api_client.exceptions import HttpClientError
from oauth2_provider.generators import generate_client_id, generate_client_secret
from rest_framework import serializers
from rest_framework.fields import empty
from rest_framework.settings import api_settings
from slumber.exceptions import HttpClientError

from django.contrib import auth
from django.contrib.sites.models import Site
Expand Down
11 changes: 8 additions & 3 deletions enterprise/api/v1/views/enterprise_customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,22 @@ def basic_list(self, request, *arg, **kwargs):
# pylint: disable=unused-argument
def support_tool(self, request, *arg, **kwargs):
"""
Enterprise Customer's detail data for the support tool
Enterprise Customer's detail data with pagination for the support tool
Supported query param:
- uuid: filter the enterprise customer uuid .
- user_query: filter the enterprise customer name.
"""
enterprise_uuid = request.GET.get('uuid')
user_query = request.GET.get("user_query", None)
queryset = self.get_queryset().order_by('name')
if user_query:
queryset = queryset.filter(Q(slug__icontains=user_query) | Q(name__icontains=user_query))
if enterprise_uuid:
queryset = queryset.filter(uuid=enterprise_uuid)
serializer = self.get_serializer(queryset, many=True)
return Response(serializer.data)
page = self.paginate_queryset(queryset)
serializer = self.get_serializer(page, many=True)
return self.get_paginated_response(serializer.data)

@has_any_permissions('enterprise.can_access_admin_dashboard',
ENTERPRISE_CUSTOMER_PROVISIONING_ADMIN_ACCESS_PERMISSION)
Expand Down
2 changes: 1 addition & 1 deletion enterprise/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
from config_models.models import ConfigurationModel
from django_countries.fields import CountryField
from edx_rbac.models import UserRole, UserRoleAssignment
from edx_rest_api_client.exceptions import HttpClientError
from fernet_fields import EncryptedCharField
from jsonfield.encoder import JSONEncoder
from jsonfield.fields import JSONField
from multi_email_field.fields import MultiEmailField
from requests.exceptions import HTTPError
from simple_history.models import HistoricalRecords
from slumber.exceptions import HttpClientError

from django.apps import apps
from django.conf import settings
Expand Down
20 changes: 20 additions & 0 deletions enterprise/toggles.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@
ENTERPRISE_LOG_PREFIX,
)

# .. toggle_name: enterprise.enterprise_groups_v2
# .. toggle_implementation: WaffleFlag
# .. toggle_default: False
# .. toggle_description: Enables enterprise groups feature
# .. toggle_use_cases: open_edx
# .. toggle_creation_date: 2024-09-24
ENTERPRISE_GROUPS_V2 = WaffleFlag(
f'{ENTERPRISE_NAMESPACE}.enterprise_groups_v2',
__name__,
ENTERPRISE_LOG_PREFIX,
)


def top_down_assignment_real_time_lcm():
"""
Expand All @@ -77,6 +89,13 @@ def enterprise_groups_v1():
return ENTERPRISE_GROUPS_V1.is_enabled()


def enterprise_groups_v2():
"""
Returns whether the enterprise groups v2 feature flag is enabled.
"""
return ENTERPRISE_GROUPS_V2.is_enabled()


def enterprise_customer_support_tool():
"""
Returns whether the enterprise customer support tool is enabled.
Expand All @@ -93,4 +112,5 @@ def enterprise_features():
'feature_prequery_search_suggestions': feature_prequery_search_suggestions(),
'enterprise_groups_v1': enterprise_groups_v1(),
'enterprise_customer_support_tool': enterprise_customer_support_tool(),
'enterprise_groups_v2': enterprise_groups_v2(),
}
2 changes: 1 addition & 1 deletion enterprise/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import pytz
from edx_django_utils.cache import TieredCache
from edx_django_utils.cache import get_cache_key as get_django_cache_key
from edx_rest_api_client.exceptions import HttpClientError
from slumber.exceptions import HttpClientError

from django.apps import apps
from django.conf import settings
Expand Down
2 changes: 1 addition & 1 deletion enterprise/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
import waffle # pylint: disable=invalid-django-waffle-import
from dateutil.parser import parse
from edx_django_utils import monitoring
from edx_rest_api_client.exceptions import HttpClientError
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from slumber.exceptions import HttpClientError

from django.apps import apps
from django.conf import settings
Expand Down
36 changes: 36 additions & 0 deletions integrated_channels/integrated_channel/exporters/learner_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ def bulk_assessment_level_export(self):
# Create a record of each subsection from every enterprise enrollment
for enterprise_enrollment in enrollment_queryset:
if not LearnerExporter.has_data_sharing_consent(enterprise_enrollment):
# Adding logging to debug the issue we are having with a customer using SAPSF channel
LOGGER.info(generate_formatted_log(
self.enterprise_configuration.channel_code(),
self.enterprise_configuration.enterprise_customer.uuid,
None,
None,
f'[SAPSF] Transmission skipped for {enterprise_enrollment.enterprise_customer_user.user_id}'
'due to missing data sharing consent.'
))
continue

assessment_grade_data = self._collect_assessment_grades_data(enterprise_enrollment)
Expand Down Expand Up @@ -192,6 +201,16 @@ def single_assessment_level_export(self, **kwargs):
detect_grade_updated=self.INCLUDE_GRADE_FOR_COMPLETION_AUDIT_CHECK,
)

# Adding logging to debug the issue we are having with a customer using SAPSF channel
LOGGER.info(generate_formatted_log( # pragma: no cover
self.enterprise_configuration.channel_code(),
self.enterprise_configuration.enterprise_customer.uuid,
None,
None,
f'[SAPSF] Transmission already sent for {enterprise_enrollment.enterprise_customer_user.user_id}'
f'is_already_transmitted returned {already_transmitted}'
))

if not (TransmissionAudit and already_transmitted) and LearnerExporter.has_data_sharing_consent(
enterprise_enrollment):

Expand All @@ -202,6 +221,14 @@ def single_assessment_level_export(self, **kwargs):
assessment_grade_data=assessment_grade_data,
)
if records:
# Adding logging to debug the issue we are having with a customer using SAPSF channel
LOGGER.info(generate_formatted_log( # pragma: no cover
self.enterprise_configuration.channel_code(),
self.enterprise_configuration.enterprise_customer.uuid,
None,
None,
f'[SAPSF] Transmission sent for {enterprise_enrollment.enterprise_customer_user.user_id}'
))
# There are some cases where we won't receive a record from the above
# method; right now, that should only happen if we have an Enterprise-linked
# user for the integrated channel, and transmission of that user's
Expand Down Expand Up @@ -497,6 +524,15 @@ def _filter_out_pre_transmitted_enrollments(
grade,
detect_grade_updated=self.INCLUDE_GRADE_FOR_COMPLETION_AUDIT_CHECK,
):
# Adding logging to debug the issue we are having with a customer using SAPSF channel
LOGGER.info(generate_formatted_log(
self.enterprise_configuration.channel_code(),
self.enterprise_configuration.enterprise_customer.uuid,
None,
None,
f'[SAPSF] Transmission skipped for {enterprise_enrollment.enterprise_customer_user.user_id}'
'transmission_audit and already_transmitted returned True.'
))
# We've already sent a completion status for this enrollment
LOGGER.info(generate_formatted_log(
channel_name, enterprise_customer_uuid, lms_user_id, course_id,
Expand Down
2 changes: 1 addition & 1 deletion requirements/celery53.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ celery==5.4.0
click==8.1.7
click-didyoumean==0.3.1
click-repl==0.3.0
kombu==5.4.0
kombu==5.4.1
prompt-toolkit==3.0.47
vine==5.1.0
6 changes: 3 additions & 3 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
#
distlib==0.3.8
# via virtualenv
filelock==3.15.4
filelock==3.16.0
# via
# tox
# virtualenv
packaging==24.1
# via tox
platformdirs==4.2.2
platformdirs==4.3.3
# via virtualenv
pluggy==1.5.0
# via tox
Expand All @@ -24,5 +24,5 @@ tox==3.28.0
# via
# -c requirements/constraints.txt
# -r requirements/ci.in
virtualenv==20.26.3
virtualenv==20.26.4
# via tox
3 changes: 0 additions & 3 deletions requirements/common_constraints.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@




# A central location for most common version constraints
# (across edx repos) for pip-installation.
#
Expand Down
22 changes: 13 additions & 9 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ bleach==6.1.0
# -r requirements/doc.txt
# -r requirements/test-master.txt
# -r requirements/test.txt
build==1.2.1
build==1.2.2
# via pip-tools
celery==5.4.0
# via
Expand Down Expand Up @@ -192,7 +192,7 @@ defusedxml==0.7.1
# -r requirements/test-master.txt
# -r requirements/test.txt
# djangorestframework-xml
diff-cover==9.1.1
diff-cover==9.2.0
# via -r requirements/test.txt
dill==0.3.8
# via pylint
Expand Down Expand Up @@ -371,11 +371,11 @@ edx-drf-extensions==10.3.0
# -r requirements/test-master.txt
# -r requirements/test.txt
# edx-rbac
edx-i18n-tools==1.6.2
edx-i18n-tools==1.6.3
# via -r requirements/dev.in
edx-lint==5.4.0
# via -r requirements/dev.in
edx-opaque-keys[django]==2.10.0
edx-opaque-keys[django]==2.11.0
# via
# -r requirements/doc.txt
# -r requirements/test-master.txt
Expand Down Expand Up @@ -489,14 +489,18 @@ jwcrypto==1.5.6
# -r requirements/test-master.txt
# -r requirements/test.txt
# django-oauth-toolkit
kombu==5.4.0
kombu==5.4.1
# via
# -r requirements/doc.txt
# -r requirements/test-master.txt
# -r requirements/test.txt
# celery
lxml==5.3.0
# via edx-i18n-tools
lxml[html-clean,html_clean]==5.3.0
# via
# edx-i18n-tools
# lxml-html-clean
lxml-html-clean==0.2.2
# via lxml
markupsafe==2.1.5
# via
# -r requirements/doc.txt
Expand Down Expand Up @@ -537,7 +541,7 @@ openai==0.28.1
# -r requirements/doc.txt
# -r requirements/test-master.txt
# -r requirements/test.txt
openedx-events==9.12.0
openedx-events==9.14.0
# via
# -r requirements/doc.txt
# -r requirements/test-master.txt
Expand Down Expand Up @@ -953,7 +957,7 @@ vine==5.1.0
# amqp
# celery
# kombu
virtualenv==20.26.3
virtualenv==20.26.4
# via tox
wcwidth==0.2.13
# via
Expand Down
6 changes: 3 additions & 3 deletions requirements/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ edx-drf-extensions==10.3.0
# via
# -r requirements/test-master.txt
# edx-rbac
edx-opaque-keys[django]==2.10.0
edx-opaque-keys[django]==2.11.0
# via
# -r requirements/test-master.txt
# edx-ccx-keys
Expand Down Expand Up @@ -290,7 +290,7 @@ jwcrypto==1.5.6
# via
# -r requirements/test-master.txt
# django-oauth-toolkit
kombu==5.4.0
kombu==5.4.1
# via
# -r requirements/test-master.txt
# celery
Expand All @@ -315,7 +315,7 @@ oauthlib==3.2.2
# django-oauth-toolkit
openai==0.28.1
# via -r requirements/test-master.txt
openedx-events==9.12.0
openedx-events==9.14.0
# via -r requirements/test-master.txt
packaging==24.1
# via
Expand Down
Loading

0 comments on commit 61100ed

Please sign in to comment.