Skip to content

Commit

Permalink
refactor: [ACI-972] change course status to is_passing & add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrii committed May 7, 2024
1 parent 619289a commit f4b66e9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"type": "record",
"fields": [
{
"name": "status",
"type": "string"
"name": "is_passing",
"type": "boolean"
},
{
"name": "user",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"type": "record",
"fields": [
{
"name": "status",
"type": "string"
"name": "is_passing",
"type": "boolean"
},
{
"name": "course",
Expand Down
10 changes: 10 additions & 0 deletions openedx_events/event_bus/avro/tests/test_custom_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,23 @@


class TestCCXLocatorSerailizer(TestCase):
"""Test case for CCXLocator serializer."""

def test_serialize(self):
"""
Test case for serializing CCXLocator object.
"""

obj1 = CCXLocator(org="edx", course="DemoX", run="Demo_course", ccx="1")
expected1 = "ccx-v1:edx+DemoX+Demo_course+ccx@1"
result1 = CcxCourseLocatorAvroSerializer.serialize(obj1)
self.assertEqual(result1, expected1)

def test_deseialize(self):
"""
Test case for deserializing CCXLocator object.
"""

data1 = "ccx-v1:edx+DemoX+Demo_course+ccx@1"
expected1 = CCXLocator(org="edx", course="DemoX", run="Demo_course", ccx="1")
result1 = CcxCourseLocatorAvroSerializer.deserialize(data1)
Expand Down
5 changes: 2 additions & 3 deletions openedx_events/learning/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,14 +528,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.
is_passing (bool): Indicates whether the user's grade is enough to pass the course.
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.
"""

status = attr.ib(type=str)
is_passing = attr.ib(type=bool)
course = attr.ib(type=CourseData)
user = attr.ib(type=UserData)

Expand Down

0 comments on commit f4b66e9

Please sign in to comment.