Skip to content

Commit

Permalink
feat: signals complete
Browse files Browse the repository at this point in the history
  • Loading branch information
ilee2u committed Sep 19, 2023
1 parent f5d4ff2 commit 4cfff65
Show file tree
Hide file tree
Showing 2 changed files with 186 additions and 2 deletions.
118 changes: 116 additions & 2 deletions openedx_events/learning/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,10 @@ class CourseEnrollmentData:


@attr.s(frozen=True)
class CertificateData:
class Invalidate:
"""
Attributes defined for Open edX Certificate data object.
Attributes dAttributes for
This is separate from ceritificate data because of how diff the params areefined for Open edX Certificate data object.
Arguments:
user (UserData): user associated with the Certificate.
Expand Down Expand Up @@ -310,3 +311,116 @@ class CourseStaffData:

course_key = attr.ib(type=str)
user = attr.ib(type=UserData)


attr.s(frozen=True)
class GradeOverrideData:
"""
Attributes defined for the Open edX Grades Override data object.
user_id (int): identifier of the user to which the grade override belongs
course_key_or_id (str): identifier of the course to which the grade override belongs
usage_key_or_id (str): identifier of the content that will get a grade override
earned_all (float): the value that the subsection grade will be changed to
earned_graded (float): the value that the subsection grade will be changed to
overrider (str): the user creating the override
comment (str): reason for the override
"""
used_id = attr.ib(type=int)
course_key_or_id = attr.ib(type=str)
usage_key_or_id = attr.ib(type=str)
earned_all = attr.ib(type=float, default=None)
earned_graded = attr.ib(type=float, default=None)
overrider = attr.ib(type=str, default=None)
comment = attr.ib(type=str, default=None)


attr.s(frozen=True)
class InstructorCompletionData:
# TODO: These docstrings!!!
"""
Attributes defined for the
"""
username = attr.ib(type=str)
content_id = attr.ib(type=str)
course_id = attr.ib(type=str, default=None)
requesting_user = attr.ib(type=UserData, default=None)


attr.s(frozen=True)
class CreditRequirementStatusData:
"""
"""
user_id = attr.id(type=int)
course_key_or_id = attr.id(type=str)
req_namespace = attr.id(type=str)
req_name = attr.id(type=str)
status = attr.id(type=str, default=None)


attr.s(frozen=True)
class InvalidateCertificateData:
"""
Attributes for
This is separate from ceritificate data because of how diff the params are
"""
user_id = attr.id(type=int)
course_id = attr.ib(type=str)
>>>>>>> 216b643 (feat: signals complete)


attr.s(frozen=True)
class GradeOverrideData:
"""
Attributes defined for the Open edX Grades Override data object.
user_id (int): identifier of the user to which the grade override belongs
course_key_or_id (str): identifier of the course to which the grade override belongs
usage_key_or_id (str): identifier of the content that will get a grade override
earned_all (float): the value that the subsection grade will be changed to
earned_graded (float): the value that the subsection grade will be changed to
overrider (str): the user creating the override
comment (str): reason for the override
"""
used_id = attr.ib(type=int)
course_key_or_id = attr.ib(type=str)
usage_key_or_id = attr.ib(type=str)
earned_all = attr.ib(type=float, default=None)
earned_graded = attr.ib(type=float, default=None)
overrider = attr.ib(type=str, default=None)
comment = attr.ib(type=str, default=None)


attr.s(frozen=True)
class InstructorCompletionData:
# TODO: These docstrings!!!
"""
Attributes defined for the
"""
username = attr.ib(type=str)
content_id = attr.ib(type=str)
course_id = attr.ib(type=str, default=None)
requesting_user = attr.ib(type=UserData, default=None)


attr.s(frozen=True)
class CreditRequirementStatusData:
"""
"""
user_id = attr.id(type=int)
course_key_or_id = attr.id(type=str)
req_namespace = attr.id(type=str)
req_name = attr.id(type=str)
status = attr.id(type=str, default=None)


attr.s(frozen=True)
class InvalidateCertificateData:
"""
Attributes for
This is separate from ceritificate data because of how diff the params are
"""
user_id = attr.id(type=int)
course_id = attr.ib(type=str)
70 changes: 70 additions & 0 deletions openedx_events/learning/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
CourseDiscussionConfigurationData,
CourseEnrollmentData,
CourseStaffData,
CreditRequirementStatusData,
GradeOverrideData,
InstructorCompletionData,
InvalidateCertificateData,
PersistentCourseGradeData,
ProgramCertificateData,
UserData,
Expand Down Expand Up @@ -219,3 +223,69 @@
"course_staff_data": CourseStaffData,
}
)

# .. event_type: org.openedx.learning.grade.override.created.v1
# .. event_name: GRADE_OVERRIDE_CREATED
# .. event_description: Emitted when a user's grade for a subsection is overriden.
# .. event_data: GradeOverrideData
GRADE_OVERRIDE_CREATED = OpenEdxPublicSignal(
event_type="org.openedx.learning.grade.override.created.v1",
data={
"grade_override_data": GradeOverrideData,
}
)

# .. event_type: org.openedx.learning.grade.override.deleted.v1
# .. event_name: GRADE_OVERRIDE_DELETED
# .. event_description: Emitted to undo a grade override for a subsection.
# .. event_data: GradeOverrideData
GRADE_OVERRIDE_DELETED = OpenEdxPublicSignal(
event_type="org.openedx.learning.grade.override.deleted.v1",
data={
"grade_override_data": GradeOverrideData,
}
)

# .. event_type: org.openedx.learning.all.child.xblocks.completed.v1
# .. event_name: ALL_CHILD_XBLOCKS_COMPLETED
# .. event_description: Emitted to mark all the child xblocks of section/subsection/unit as completed.
# .. event_data: InstructorCompletionData
ALL_CHILD_XBLOCKS_COMPLETED = OpenEdxPublicSignal(
event_type="org.openedx.learning.all.child.xblocks.completed.v1",
data={
"instructor_completed_data": InstructorCompletionData,
}
)

# .. event_type: org.openedx.learning.all.child.xblocks.reset.v1
# .. event_name: ALL_CHILD_XBLOCKS_RESET
# .. event_description: Emitted to reset the state of all child xblocks in a section/subsection/unit.
# .. event_data: InstructorCompletionData
ALL_CHILD_XBLOCKS_RESET = OpenEdxPublicSignal(
event_type="org.openedx.learning.all.child.xblocks.reset.v1",
data={
"instructor_completed_data": InstructorCompletionData,
}
)

# .. event_type: org.openedx.learning.credit.requirement.status.set.v1
# .. event_name: CREDIT_REQUIREMENT_STATUS_SET
# .. event_description: Creates or modifies a user's credit requirement status for a course.
# .. event_data: CreditRequirementStatusData
CREDIT_REQUIREMENT_STATUS_SET = OpenEdxPublicSignal(
event_type="org.openedx.learning.set.credit.requirement.status.set.v1",
data={
"credit_requirement_status_data": CreditRequirementStatusData,
}
)

# .. event_type: org.openedx.learning.credit.requirement.status.data.v1
# .. event_name: CREDIT_REQUIREMENT_STATUS_REMOVED
# .. event_description: Deletes a user's credit requirement status for a course.
# .. event_data: CreditRequirementStatusData
CREDIT_REQUIREMENT_STATUS_REMOVED = OpenEdxPublicSignal(
event_type="org.openedx.learning.remove.credit.requirement.status.v1",
data={
"credit_requirement_status_data": CreditRequirementStatusData,
}
)

0 comments on commit 4cfff65

Please sign in to comment.