-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new COURSE_CATALOG_INFO_CHANGED signal for course_authoring (#81)
* feat: new COURSE_CATALOG_INFO_CHANGED signal for course_authoring
- Loading branch information
Showing
6 changed files
with
107 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
more information about the project. | ||
""" | ||
|
||
__version__ = "0.10.0" | ||
__version__ = "0.11.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
""" | ||
Package where events related to the ``content_authoring`` subdomain are implemented. | ||
""" | ||
# Comment broken up to deal with line-length issues with the long URL | ||
|
||
# The ``content_authoring`` subdomain corresponds to {Architecture Subdomain} defined in OEP-41. | ||
# https://open-edx-proposals.readthedocs.io/en/latest/architectural-decisions/oep-0041-arch-async-server-event-messaging.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
""" | ||
Data attributes for events within the architecture subdomain ``content_authoring``. | ||
These attributes follow the form of attr objects specified in OEP-49 data | ||
pattern. | ||
The attributes for the events come from the CourseDetailView in the LMS, with some unused fields removed | ||
(see deprecation proposal at https://github.com/openedx/public-engineering/issues/160) | ||
""" | ||
from datetime import datetime | ||
|
||
import attr | ||
from opaque_keys.edx.keys import CourseKey | ||
|
||
|
||
@attr.s(frozen=True) | ||
class CourseScheduleData: | ||
""" | ||
Data describing course scheduling. | ||
Arguments: | ||
start (datetime): course start date | ||
pacing (str): 'instructor' or 'self' | ||
end (datetime): course end date (optional) | ||
enrollment_start (datetime): start of course enrollment (optional) | ||
enrollment_end (datetime): end of course enrollment (optional) | ||
""" | ||
|
||
start = attr.ib(type=datetime) | ||
pacing = attr.ib(type=str) | ||
end = attr.ib(type=datetime, default=None) | ||
enrollment_start = attr.ib(type=datetime, default=None) | ||
enrollment_end = attr.ib(type=datetime, default=None) | ||
|
||
|
||
@attr.s(frozen=True) | ||
class CourseCatalogData: | ||
""" | ||
Data needed for a course catalog entry. | ||
Arguments: | ||
course_key (CourseKey): identifier of the Course object. | ||
name (str): course name | ||
org (str): course organization identifier | ||
number (str): course number | ||
schedule_data (CourseScheduleData): scheduling information for the course | ||
short_description (str): one- or two-sentence course description (optional) | ||
effort (str): estimated level of effort in hours per week (optional). Kept as a str to align with the lms model. | ||
hidden (bool): whether the course is hidden from search (optional) | ||
invitation_only (bool): whether the course requires an invitation to enroll | ||
""" | ||
|
||
# basic identifiers | ||
course_key = attr.ib(type=CourseKey) | ||
name = attr.ib(type=str) | ||
number = attr.ib(type=str) | ||
org = attr.ib(type=str) | ||
|
||
# additional marketing information | ||
schedule_data = attr.ib(type=CourseScheduleData) | ||
short_description = attr.ib(type=str, default=None) | ||
effort = attr.ib(type=str, default=None) | ||
hidden = attr.ib(type=bool, default=False) | ||
invitation_only = attr.ib(type=bool, default=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
""" | ||
Signal definitions for events within the architecture subdomain ``content_authoring``. | ||
All signals defined in this module must follow the name and versioning | ||
conventions specified in OEP-41. | ||
They also must comply with the payload definition specified in | ||
docs/decisions/0003-events-payload.rst | ||
""" | ||
|
||
from openedx_events.content_authoring.data import CourseCatalogData | ||
from openedx_events.tooling import OpenEdxPublicSignal | ||
|
||
# .. event_type: org.openedx.content_authoring.course.catalog_info.changed.v1 | ||
# .. event_name: COURSE_CATALOG_INFO_CHANGED | ||
# .. event_description: Fired when a course changes in Studio in a way that is relevant for catalog consumers. | ||
# .. event_data: CourseCatalogData | ||
COURSE_CATALOG_INFO_CHANGED = OpenEdxPublicSignal( | ||
event_type="org.openedx.content_authoring.course.catalog_info.changed.v1", | ||
data={ | ||
"catalog_info": CourseCatalogData, | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters