diff --git a/openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+ccx+course+passing+status+v1_schema.avsc b/openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+ccx+course+passing+status+updated+v1_schema.avsc similarity index 97% rename from openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+ccx+course+passing+status+v1_schema.avsc rename to openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+ccx+course+passing+status+updated+v1_schema.avsc index 2f0056aa..81bc1a2e 100644 --- a/openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+ccx+course+passing+status+v1_schema.avsc +++ b/openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+ccx+course+passing+status+updated+v1_schema.avsc @@ -104,5 +104,5 @@ } } ], - "namespace": "org.openedx.learning.ccx.course.passing.status.v1" + "namespace": "org.openedx.learning.ccx.course.passing.status.updated.v1" } \ No newline at end of file diff --git a/openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+course+passing+status+v1_schema.avsc b/openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+course+passing+status+updated+v1_schema.avsc similarity index 97% rename from openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+course+passing+status+v1_schema.avsc rename to openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+course+passing+status+updated+v1_schema.avsc index 085c11c1..a20b821f 100644 --- a/openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+course+passing+status+v1_schema.avsc +++ b/openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+course+passing+status+updated+v1_schema.avsc @@ -88,5 +88,5 @@ } } ], - "namespace": "org.openedx.learning.course.passing.status.v1" + "namespace": "org.openedx.learning.course.passing.status.updated.v1" } \ No newline at end of file diff --git a/openedx_events/event_bus/avro/tests/test_avro.py b/openedx_events/event_bus/avro/tests/test_avro.py index bf2f1836..2596192f 100644 --- a/openedx_events/event_bus/avro/tests/test_avro.py +++ b/openedx_events/event_bus/avro/tests/test_avro.py @@ -5,6 +5,7 @@ from typing import List from unittest import TestCase +from ccx_keys.locator import CCXLocator from fastavro import schemaless_reader, schemaless_writer from fastavro.repository.base import SchemaRepositoryError from fastavro.schema import load_schema @@ -97,7 +98,7 @@ def generate_test_event_data_for_data_type(data_type): # pragma: no cover defaults_per_type = { int: 1, bool: True, - str: "default", + str: "passing", float: 1.0, CourseKey: CourseKey.from_string("course-v1:edX+DemoX.1+2014"), UsageKey: UsageKey.from_string( @@ -107,6 +108,7 @@ def generate_test_event_data_for_data_type(data_type): # pragma: no cover LibraryUsageLocatorV2: LibraryUsageLocatorV2.from_string('lb:MITx:reallyhardproblems:problem:problem1'), List[int]: [1, 2, 3], datetime: datetime.now(), + CCXLocator: CCXLocator(org='edx', course='DemoX', run='Demo_course', ccx='1'), } data_dict = {} for attribute in data_type.__attrs_attrs__: diff --git a/openedx_events/learning/data.py b/openedx_events/learning/data.py index 9595dbf1..901dbffb 100644 --- a/openedx_events/learning/data.py +++ b/openedx_events/learning/data.py @@ -88,7 +88,8 @@ class CcxCourseData: 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. + 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) @@ -510,10 +511,13 @@ class CoursePassingStatusData: Represents the event data when a user's grade is updated, indicates if current grade is enough for course passing. Attributes: - status (str): A string containing information about user's current course grade value in comparison to the grading policy threshold. + status (str): A string containing information about user's current course grade value + in comparison to the grading policy threshold. user (UserData): An instance of UserData containing information about the user whose grade was updated. - course (CourseData): An instance of CourseData containing details about the course in which the grade was updated. + course (CourseData): An instance of CourseData containing details about the course + in which the grade was updated. """ + PASSING = 'passing' FAILING = 'failing' STATUSES = [PASSING, FAILING] @@ -532,9 +536,11 @@ class CcxCoursePassingStatusData(CoursePassingStatusData): providing a custom course attribute suited for CCX course instances. Attributes: - course (CcxCourseData): An instance of CcxCourseData containing details about the CCX course in which the grade threshold was crossed. + course (CcxCourseData): An instance of CcxCourseData containing details about the CCX course + in which the grade threshold was crossed. All other attributes are inherited from CoursePassingStatusData. """ + course = attr.ib(type=CcxCourseData) diff --git a/openedx_events/learning/signals.py b/openedx_events/learning/signals.py index dc563375..d3970066 100644 --- a/openedx_events/learning/signals.py +++ b/openedx_events/learning/signals.py @@ -16,8 +16,8 @@ CourseAccessRoleData, CourseDiscussionConfigurationData, CourseEnrollmentData, - CoursePassingStatusData, CourseNotificationData, + CoursePassingStatusData, DiscussionThreadData, ExamAttemptData, ORASubmissionData, @@ -400,4 +400,4 @@ data={ "badge": BadgeData, } -) \ No newline at end of file +)