Skip to content

Conversation

@mariajgrimaldi
Copy link
Contributor

@mariajgrimaldi mariajgrimaldi commented Oct 28, 2021

Description

This PR adds support for Open edX Events in Limonero. These events are part of the OEP-50: Hooks Extension Framework implementation plan.

Since the OEP-50 publication, there has been a lot of discussion surrounding the design of this new extension point; I'll address some here for context:

  • These events are defined in the library openedx-events and will be imported here to be triggered in a specific list of places.
  • The class OpenEdxPublicSignal -a subclass of Django signals- is used to create each event.
  • send_event is the method that replaces send and send_robust.
  • Each event sends payloads based on Data Attr classes. For more information: Open edX Events Payload Conventions
  • Events unit test guarantees that they are being sent in the proper context. For example, STUDENT_REGISTRATION_COMPLETED is sent after the user's registration.

For an overall understanding of the design, check out the Open edX Events ADRs and discussions:

  1. Open edX Event naming and versioning ADR
  2. Open edX Event Payload Conventions ADR
  3. Community discussion about Open edX Events design
  4. Community discussion about Hooks Extension Framework

Supporting information

Discuss on Hooks Extension Framework:
https://discuss.openedx.org/t/configuration-for-the-hooks-extension-framework/4527/

Testing instructions

  1. Checkout to li/ednx/JU-6_P2
  2. Install Open edX Events library:
    pip install openedx-events==0.6.0
  3. Connect your custom receiver to the signal as follows:
from openedx_events.learning.signals import STUDENT_REGISTRATION_COMPLETED

@receiver(STUDENT_REGISTRATION_COMPLETED)
def callback(**kwargs):

@mariajgrimaldi mariajgrimaldi changed the base branch from master to edunext/limonero.master October 28, 2021 17:01
@mariajgrimaldi mariajgrimaldi changed the base branch from edunext/limonero.master to li/ednx/JU-6 October 28, 2021 17:02
@mariajgrimaldi mariajgrimaldi changed the title Li/ednx/ju 6 p2 JU-6: add support for openedx-events Nov 2, 2021
@MoisesGSalas
Copy link
Member

@mariajgrimaldi How much does this differ from the upstream code? Where did you have to make adjustments if any?

@mariajgrimaldi
Copy link
Contributor Author

mariajgrimaldi commented Nov 3, 2021

Good question, @MoisesGSalas. Thanks.

  1. In this platform version, the method _revoke_certificate does not exist, so we added CERTIFICATE_REVOKED to invalidate and mark_notpassing instead
  2. The login reverse was not working, so I replaced it with this

The rest is the same:

  1. Add event to process. i.e registration
  2. Create test_events.py file for events related to the process
  3. Add mixin which enable/disable events to test case classes that interact with the process. This is to avoid sending events when not needed.

@mariajgrimaldi mariajgrimaldi force-pushed the li/ednx/JU-6 branch 3 times, most recently from 4abfc60 to 74ee7ac Compare November 3, 2021 22:08
@mariajgrimaldi mariajgrimaldi changed the base branch from li/ednx/JU-6 to edunext/limonero.master November 4, 2021 13:26
* Add STUDENT_REGISTRATION_COMPLETED event after the user's registration
* Add SESSION_LOGIN_COMPLETED event after the user's login session
* Add COURSE_ENROLLMENT_CREATED event after the user's enrollment
creation
* Add COURSE_ENROLLMENT_CHANGED: sent after the enrollment update
* Add COURSE_UNENROLLMENT_COMPLETED: sent after the user's unenrollment
* Add CERTIFICATE_CREATED after the user's certificate generation has
been completed
* Add CERTIFICATE_CHANGED: after the certification update has been
completed
* Add CERTIFICATE_REVOKED: after the certificate revocation has been
completed
* Add COHORT_MEMBERSHIP_CHANGED: when a cohort membership update ends
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants