Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: [ACI-502, ACI-503] redesign course grading events payload #2520

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions lms/djangoapps/grades/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
from crum import get_current_user
from django.conf import settings
from eventtracking import tracker
from openedx_events.learning.data import UserCourseData, CourseData, UserData, UserPersonalData
from openedx_events.learning.signals import (
COURSE_GRADE_NOW_PASSED as COURSE_GRADE_NOW_PASSED_PUBLIC,
COURSE_GRADE_NOW_FAILED as COURSE_GRADE_NOW_FAILED_PUBLIC,
)
from openedx_events.learning.data import CcxCoursePassingStatusData, CourseData, CoursePassingStatusData, UserData, UserPersonalData
from openedx_events.learning.signals import CCX_COURSE_PASSING_STATUS_UPDATED, COURSE_PASSING_STATUS_UPDATED

from common.djangoapps.course_modes.models import CourseMode
from common.djangoapps.student.models import CourseEnrollment
Expand Down Expand Up @@ -196,8 +193,9 @@ def course_grade_now_passed(user, course_id):
)

# produce to event bus
COURSE_GRADE_NOW_PASSED_PUBLIC.send_event(
user_course_data=UserCourseData(
COURSE_PASSING_STATUS_UPDATED.send_event(
course_passing_status=CoursePassingStatusData(
status=CoursePassingStatusData.PASSING,
user=UserData(
pii=UserPersonalData(
username=user.username,
Expand All @@ -210,6 +208,8 @@ def course_grade_now_passed(user, course_id):
course=CourseData(
course_key=course_id,
),
update_timestamp=None,
grading_policy_hash=None,
)
)

Expand All @@ -233,8 +233,9 @@ def course_grade_now_failed(user, course_id):
)

# produce to event bus
COURSE_GRADE_NOW_FAILED_PUBLIC.send_event(
user_course_data=UserCourseData(
COURSE_PASSING_STATUS_UPDATED.send_event(
course_passing_status=CoursePassingStatusData(
status = CoursePassingStatusData.FAILING,
user=UserData(
pii=UserPersonalData(
username=user.username,
Expand All @@ -247,6 +248,8 @@ def course_grade_now_failed(user, course_id):
course=CourseData(
course_key=course_id,
),
update_timestamp=None,
grading_policy_hash=None,
)
)

Expand Down
8 changes: 4 additions & 4 deletions lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -5277,15 +5277,15 @@ def _make_locale_paths(settings): # pylint: disable=missing-function-docstring
# Note: The topic names should not include environment prefix as it will be dynamically added based on
# EVENT_BUS_TOPIC_PREFIX setting.
EVENT_BUS_PRODUCER_CONFIG = {
"org.openedx.learning.course.grade.now.passed.v1": {
"org.openedx.learning.course.passing.status.v1": {
"learning-badges-lifecycle": {
"event_key_field": "user_course_data.course.course_key",
"event_key_field": "course_passing_status.course.course_key",
"enabled": True,
},
},
"org.openedx.learning.course.grade.now.failed.v1": {
"org.openedx.learning.ccx.course.passing.status.v1": {
"learning-badges-lifecycle": {
"event_key_field": "user_course_data.course.course_key",
"event_key_field": "course_passing_status.course.course_key",
"enabled": True,
},
},
Expand Down
Loading