forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from Pearson-Advance/vue/PADV-1276
PADV 1276 - Move edx-platform changes to our repository
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
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 | ||
|
||
|
||
def emit_course_passing_status_update(user, course_id, is_passing): | ||
if hasattr(course_id, 'ccx'): | ||
CCX_COURSE_PASSING_STATUS_UPDATED.send_event( | ||
course_passing_status=CcxCoursePassingStatusData( | ||
is_passing=is_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(), | ||
), | ||
) | ||
) | ||
else: | ||
COURSE_PASSING_STATUS_UPDATED.send_event( | ||
course_passing_status=CoursePassingStatusData( | ||
is_passing=is_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, | ||
), | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters