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

feat: [ACI-513, ACI-519] Emit CCX course FAILING/PASSING status #2526

Merged
merged 1 commit into from
Mar 31, 2024
Merged
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
113 changes: 78 additions & 35 deletions lms/djangoapps/grades/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
from crum import get_current_user
from django.conf import settings
from eventtracking import tracker
from openedx_events.learning.data import CcxCoursePassingStatusData, CourseData, CoursePassingStatusData, UserData, UserPersonalData
from openedx_events.learning.data import (
CcxCourseData,
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
Expand Down Expand Up @@ -193,25 +200,43 @@ def course_grade_now_passed(user, course_id):
)

# produce to event bus
COURSE_PASSING_STATUS_UPDATED.send_event(
course_passing_status=CoursePassingStatusData(
status=CoursePassingStatusData.PASSING,
user=UserData(
pii=UserPersonalData(
username=user.username,
email=user.email,
name=user.get_full_name(),
if hasattr(course_id, 'ccx'):
CCX_COURSE_PASSING_STATUS_UPDATED.send_event(
course_passing_status=CcxCoursePassingStatusData(
status=CcxCoursePassingStatusData.PASSING,
user=UserData(
pii=UserPersonalData(
username=user.username,
email=user.email,
name=user.get_full_name(),
),
id=user.id,
is_active=user.is_active,
),
course=CcxCourseData(
ccx_course_key=course_id,
master_course_key=course_id.to_course_locator(),
),
id=user.id,
is_active=user.is_active,
),
course=CourseData(
course_key=course_id,
),
update_timestamp=None,
grading_policy_hash=None,
)
)
else:
COURSE_PASSING_STATUS_UPDATED.send_event(
course_passing_status=CoursePassingStatusData(
status=CoursePassingStatusData.PASSING,
user=UserData(
pii=UserPersonalData(
username=user.username,
email=user.email,
name=user.get_full_name(),
),
id=user.id,
is_active=user.is_active,
),
course=CourseData(
course_key=course_id,
),
)
)
)


def course_grade_now_failed(user, course_id):
Expand All @@ -233,25 +258,43 @@ def course_grade_now_failed(user, course_id):
)

# produce to event bus
COURSE_PASSING_STATUS_UPDATED.send_event(
course_passing_status=CoursePassingStatusData(
status = CoursePassingStatusData.FAILING,
user=UserData(
pii=UserPersonalData(
username=user.username,
email=user.email,
name=user.get_full_name(),
if hasattr(course_id, 'ccx'):
CCX_COURSE_PASSING_STATUS_UPDATED.send_event(
course_passing_status=CcxCoursePassingStatusData(
status=CcxCoursePassingStatusData.FAILING,
user=UserData(
pii=UserPersonalData(
username=user.username,
email=user.email,
name=user.get_full_name(),
),
id=user.id,
is_active=user.is_active,
),
id=user.id,
is_active=user.is_active,
),
course=CourseData(
course_key=course_id,
),
update_timestamp=None,
grading_policy_hash=None,
course=CcxCourseData(
ccx_course_key=course_id,
master_course_key=course_id.to_course_locator(),
),
)
)
else:
COURSE_PASSING_STATUS_UPDATED.send_event(
course_passing_status=CoursePassingStatusData(
status = CoursePassingStatusData.FAILING,
user=UserData(
pii=UserPersonalData(
username=user.username,
email=user.email,
name=user.get_full_name(),
),
id=user.id,
is_active=user.is_active,
),
course=CourseData(
course_key=course_id,
),
)
)
)


def fire_segment_event_on_course_grade_passed_first_time(user_id, course_locator):
Expand Down
Loading