Skip to content

Commit

Permalink
feat: [ACI-69, ACI-87] describe new public events for course grade pa…
Browse files Browse the repository at this point in the history
…ssing/failing

feat: [ACI-75] new public events
  • Loading branch information
wowkalucky authored Jan 15, 2024
2 parents 1a5f9ca + 2b4563f commit 2fadf62
Show file tree
Hide file tree
Showing 4 changed files with 213 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"name": "CloudEvent",
"type": "record",
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema",
"fields": [
{
"name": "user_course_data",
"type": {
"name": "UserCourseData",
"type": "record",
"fields": [
{
"name": "user",
"type": {
"name": "UserData",
"type": "record",
"fields": [
{
"name": "id",
"type": "long"
},
{
"name": "is_active",
"type": "boolean"
},
{
"name": "pii",
"type": {
"name": "UserPersonalData",
"type": "record",
"fields": [
{
"name": "username",
"type": "string"
},
{
"name": "email",
"type": "string"
},
{
"name": "name",
"type": "string"
}
]
}
}
]
}
},
{
"name": "course",
"type": {
"name": "CourseData",
"type": "record",
"fields": [
{
"name": "course_key",
"type": "string"
},
{
"name": "display_name",
"type": "string"
},
{
"name": "start",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "end",
"type": [
"null",
"string"
],
"default": null
}
]
}
}
]
}
}
],
"namespace": "org.openedx.learning.course.grade.now.failed.v1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"name": "CloudEvent",
"type": "record",
"doc": "Avro Event Format for CloudEvents created with openedx_events/schema",
"fields": [
{
"name": "user_course_data",
"type": {
"name": "UserCourseData",
"type": "record",
"fields": [
{
"name": "user",
"type": {
"name": "UserData",
"type": "record",
"fields": [
{
"name": "id",
"type": "long"
},
{
"name": "is_active",
"type": "boolean"
},
{
"name": "pii",
"type": {
"name": "UserPersonalData",
"type": "record",
"fields": [
{
"name": "username",
"type": "string"
},
{
"name": "email",
"type": "string"
},
{
"name": "name",
"type": "string"
}
]
}
}
]
}
},
{
"name": "course",
"type": {
"name": "CourseData",
"type": "record",
"fields": [
{
"name": "course_key",
"type": "string"
},
{
"name": "display_name",
"type": "string"
},
{
"name": "start",
"type": [
"null",
"string"
],
"default": null
},
{
"name": "end",
"type": [
"null",
"string"
],
"default": null
}
]
}
}
]
}
}
],
"namespace": "org.openedx.learning.course.grade.now.passed.v1"
}
14 changes: 14 additions & 0 deletions openedx_events/learning/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,3 +469,17 @@ class CourseNotificationData:
content_url = attr.ib(type=str)
content_context = attr.ib(type=dict, factory=dict)
audience_filters = attr.ib(type=dict, factory=dict)


@attr.s(frozen=True)
class UserCourseData:
"""
Attributes defined for Open edX user course data object.
Arguments:
user (UserData): user associated with the Course Enrollment.
course (CourseData): course where the user is enrolled in.
"""

user = attr.ib(type=UserData)
course = attr.ib(type=CourseData)
23 changes: 23 additions & 0 deletions openedx_events/learning/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
ManageStudentsPermissionData,
PersistentCourseGradeData,
ProgramCertificateData,
UserCourseData,
UserData,
UserNotificationData,
XBlockSkillVerificationData,
Expand Down Expand Up @@ -327,3 +328,25 @@
"course_notification_data": CourseNotificationData,
}
)

# .. event_type: org.openedx.learning.course.grade.now.passed.v1
# .. event_name: COURSE_GRADE_NOW_PASSED
# .. event_description: Emmited when course grade is passed.
# .. event_data: UserCourseData
COURSE_GRADE_NOW_PASSED = OpenEdxPublicSignal(
event_type="org.openedx.learning.course.grade.now.passed.v1",
data={
"user_course_data": UserCourseData,
}
)

# .. event_type: org.openedx.learning.course.grade.now.failed.v1
# .. event_name: COURSE_GRADE_NOW_FAILED
# .. event_description: Emmited when course grade is failed.
# .. event_data: UserCourseData
COURSE_GRADE_NOW_FAILED = OpenEdxPublicSignal(
event_type="org.openedx.learning.course.grade.now.failed.v1",
data={
"user_course_data": UserCourseData,
}
)

0 comments on commit 2fadf62

Please sign in to comment.