Skip to content

Commit

Permalink
feat: [ACI-512] update CCX events payload (#6)
Browse files Browse the repository at this point in the history
* feat: [ACI-512] update CCX events payload

* chore(deps): upgrade dependencies

* feat(deps): add edx-ccx-keys library
  • Loading branch information
wowkalucky authored Mar 26, 2024
1 parent ca46345 commit ad0aabb
Show file tree
Hide file tree
Showing 10 changed files with 122 additions and 177 deletions.
28 changes: 16 additions & 12 deletions openedx_events/learning/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from typing import List, Optional

import attr
from ccx_keys.locator import CCXLocator
from opaque_keys.edx.keys import CourseKey, UsageKey


Expand Down Expand Up @@ -497,21 +498,24 @@ class BadgeData:


@attr.s(frozen=True)
class CcxCourseData(CourseData):
class CcxCourseData:
"""
Attributes defined fir the Open edX custom course data object.
Represents data for a CCX (Custom Courses for edX) course.
Arguments:
master_course_key (str): identifier of the master Course object.
max_students_allowed (int): maximum number of students allowed on the custom course
coach (UserData): coach associated with the custom course
Attributes:
ccx_course_key (CCXLocator): The unique identifier for the CCX course.
master_course_key (CourseKey): The unique identifier for the original course from which the CCX is derived.
display_name (str): The name of the CCX course as it should appear to users.
coach_email (str): The email address of the coach (instructor) for the CCX course.
start (str, optional): The start date of the CCX course. Defaults to None, indicating no specific start date.
end (str, optional): The end date of the CCX course. Defaults to None, indicating no specific end date.
max_students_allowed (int, optional): The maximum number of students that can enroll in the CCX course. Defaults to None, indicating no limit.
"""

ccx_course_key = attr.ib(type=CCXLocator)
master_course_key = attr.ib(type=CourseKey)
max_students_allowed = attr.ib(type=int)
coach = attr.ib(type=UserData)

# copypasted from CourseData to avoid ValueError
display_name = attr.ib(type=str, factory=str)
start = attr.ib(type=datetime, default=None)
end = attr.ib(type=datetime, default=None)
coach_email = attr.ib(type=str, factory=str)
start = attr.ib(type=str, default=None)
end = attr.ib(type=str, default=None)
max_students_allowed = attr.ib(type=int, default=None)
1 change: 1 addition & 0 deletions requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ django
attrs
fastavro
edx-opaque-keys[django]
edx-ccx-keys
18 changes: 10 additions & 8 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# make upgrade
#
asgiref==3.7.2
asgiref==3.8.1
# via django
attrs==23.2.0
# via -r requirements/base.in
backports-zoneinfo==0.2.1
# via django
cffi==1.16.0
# via pynacl
click==8.1.7
Expand All @@ -25,10 +23,14 @@ django-crum==0.7.9
# via edx-django-utils
django-waffle==4.1.0
# via edx-django-utils
edx-ccx-keys==1.2.1
# via -r requirements/base.in
edx-django-utils==5.11.0
# via -r requirements/base.in
edx-opaque-keys[django]==2.5.1
# via -r requirements/base.in
# via
# -r requirements/base.in
# edx-ccx-keys
fastavro==1.9.4
# via -r requirements/base.in
newrelic==9.7.1
Expand All @@ -43,13 +45,13 @@ pymongo==3.13.0
# via edx-opaque-keys
pynacl==1.5.0
# via edx-django-utils
six==1.16.0
# via edx-ccx-keys
sqlparse==0.4.4
# via django
stevedore==5.2.0
# via
# edx-django-utils
# edx-opaque-keys
typing-extensions==4.10.0
# via
# asgiref
# edx-opaque-keys
# via edx-opaque-keys
10 changes: 3 additions & 7 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# make upgrade
Expand All @@ -12,7 +12,7 @@ colorama==0.4.6
# via tox
distlib==0.3.8
# via virtualenv
filelock==3.13.1
filelock==3.13.3
# via
# tox
# virtualenv
Expand All @@ -28,11 +28,7 @@ pluggy==1.4.0
# via tox
pyproject-api==1.6.1
# via tox
tomli==2.0.1
# via
# pyproject-api
# tox
tox==4.14.1
tox==4.14.2
# via -r requirements/ci.in
virtualenv==20.25.1
# via tox
64 changes: 22 additions & 42 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
# make upgrade
#
asgiref==3.7.2
asgiref==3.8.1
# via
# -r requirements/quality.txt
# django
Expand All @@ -16,10 +16,6 @@ astroid==2.15.8
# pylint-celery
attrs==23.2.0
# via -r requirements/quality.txt
backports-zoneinfo==0.2.1
# via
# -r requirements/quality.txt
# django
build==1.1.1
# via
# -r requirements/pip-tools.txt
Expand Down Expand Up @@ -66,7 +62,7 @@ colorama==0.4.6
# via
# -r requirements/ci.txt
# tox
coverage[toml]==7.4.3
coverage[toml]==7.4.4
# via
# -r requirements/quality.txt
# pytest-cov
Expand Down Expand Up @@ -101,19 +97,19 @@ docutils==0.20.1
# via
# -r requirements/quality.txt
# readme-renderer
edx-ccx-keys==1.2.1
# via -r requirements/quality.txt
edx-django-utils==5.11.0
# via -r requirements/quality.txt
edx-lint==5.3.6
# via -r requirements/quality.txt
edx-opaque-keys[django]==2.5.1
# via -r requirements/quality.txt
exceptiongroup==1.2.0
# via
# -r requirements/quality.txt
# pytest
# edx-ccx-keys
fastavro==1.9.4
# via -r requirements/quality.txt
filelock==3.13.1
filelock==3.13.3
# via
# -r requirements/ci.txt
# tox
Expand All @@ -125,15 +121,8 @@ idna==3.6
importlib-metadata==6.11.0
# via
# -c https://raw.githubusercontent.com/openedx/edx-lint/master/edx_lint/files/common_constraints.txt
# -r requirements/pip-tools.txt
# -r requirements/quality.txt
# build
# keyring
# twine
importlib-resources==6.3.0
# via
# -r requirements/quality.txt
# keyring
iniconfig==2.0.0
# via
# -r requirements/quality.txt
Expand All @@ -146,12 +135,20 @@ jaraco-classes==3.3.1
# via
# -r requirements/quality.txt
# keyring
jaraco-context==4.3.0
# via
# -r requirements/quality.txt
# keyring
jaraco-functools==4.0.0
# via
# -r requirements/quality.txt
# keyring
jinja2==3.1.3
# via
# -r requirements/quality.txt
# code-annotations
# diff-cover
keyring==24.3.1
keyring==25.0.0
# via
# -r requirements/quality.txt
# twine
Expand Down Expand Up @@ -179,11 +176,12 @@ more-itertools==10.2.0
# via
# -r requirements/quality.txt
# jaraco-classes
# jaraco-functools
newrelic==9.7.1
# via
# -r requirements/quality.txt
# edx-django-utils
nh3==0.2.15
nh3==0.2.17
# via
# -r requirements/quality.txt
# readme-renderer
Expand Down Expand Up @@ -280,7 +278,7 @@ pytest==8.1.1
# -r requirements/quality.txt
# pytest-cov
# pytest-django
pytest-cov==4.1.0
pytest-cov==5.0.0
# via -r requirements/quality.txt
pytest-django==4.8.0
# via -r requirements/quality.txt
Expand Down Expand Up @@ -316,6 +314,7 @@ rich==13.7.1
six==1.16.0
# via
# -r requirements/quality.txt
# edx-ccx-keys
# edx-lint
snowballstemmer==2.2.0
# via
Expand All @@ -335,35 +334,18 @@ text-unidecode==1.3
# via
# -r requirements/quality.txt
# python-slugify
tomli==2.0.1
# via
# -r requirements/ci.txt
# -r requirements/pip-tools.txt
# -r requirements/quality.txt
# build
# coverage
# pip-tools
# pylint
# pyproject-api
# pyproject-hooks
# pytest
# tox
tomlkit==0.12.4
# via
# -r requirements/quality.txt
# pylint
tox==4.14.1
tox==4.14.2
# via -r requirements/ci.txt
twine==5.0.0
# via -r requirements/quality.txt
typing-extensions==4.10.0
# via
# -r requirements/quality.txt
# asgiref
# astroid
# edx-opaque-keys
# pylint
# rich
urllib3==2.2.1
# via
# -r requirements/quality.txt
Expand All @@ -381,12 +363,10 @@ wrapt==1.16.0
# via
# -r requirements/quality.txt
# astroid
zipp==3.18.0
zipp==3.18.1
# via
# -r requirements/pip-tools.txt
# -r requirements/quality.txt
# importlib-metadata
# importlib-resources

# The following packages are considered to be unsafe in a requirements file:
# pip
Expand Down
Loading

0 comments on commit ad0aabb

Please sign in to comment.