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

PADV-806: feat: add course created event signals #109

Merged

Conversation

JuanDavidBuitrago
Copy link

@JuanDavidBuitrago JuanDavidBuitrago commented Nov 27, 2023

Description

This PR adds the COURSE_CREATED signal in olive version.

Testing instruction

  1. Use this branch vue/PADV-806-course-created to use the necessary changes
  2. Setup frontend-app-library-authoring if not done before:
    from .devstack import FEATURES
    FEATURES['ENABLE_LIBRARY_AUTHORING_MICROFRONTEND'] = True
    BLOCKSTORE_API_AUTH_TOKEN = 'edxapp-insecure-devstack-key'
  1. Set up the blockstore to run in devstack (ref) by running the following from the studio shell (make studio-shell):
# Configure blockstore to run inside LMS/Studio (instead of as an external service)
./manage.py cms waffle_switch --create blockstore.use_blockstore_app_api on

./manage.py cms shell  # enter python code below

# Create a "Collection" that new content libraries / xblocks can be created within:
from blockstore.apps.bundles.models import Collection
coll, _ = Collection.objects.get_or_create(title='Devstack Content Collection', uuid='11111111-2111-4111-8111-111111111111')

# Create an "Organization":
from organizations.models import Organization
Organization.objects.get_or_create(short_name='DeveloperInc', defaults={'name': 'DeveloperInc', 'active': True})
  1. Add below snippet somewhere, for example in cms/djangoapps/contentstore/signals/handlers.py:
from openedx_events.content_authoring.signals import COURSE_CREATED
COURSE_CREATED.connect(lambda **x: print("test_event: ", x))
  1. Open studio in http://localhost:18010/
  2. Open studio logs monitoring:
make studio-logs | grep test_event:
  1. Create a course
    Check the log for COURSE_CREATED

  2. Should see something like:

make studio-logs | grep test_event:
edx.devstack-olive.master.studio   | test_event:  {'signal': <OpenEdxPublicSignal: org.openedx.content_authoring.xblock.updated.v1>, 'sender': None, 'xblock_info': XBlockData(usage_key=BlockUsageLocator(CourseLocator('demo', 'demo1', '2020', None, None), 'course', 'course'), block_type='course', version=BlockUsageLocator(CourseLocator('demo', 'demo1', '2020', 'draft-branch', ObjectId('655df4e81593fe8f4610c9a8')), 'course', 'course')), 'metadata': EventsMetadata(event_type='org.openedx.content_authoring.xblock.updated.v1', id=UUID('39d5e9d2-8933-11ee-8a88-0242ac130010'), minorversion=0, source='openedx/cms/web', sourcehost='studio.devstack.edx', time=datetime.datetime(2023, 11, 22, 12, 32, 40, 172109, tzinfo=datetime.timezone.utc), sourcelib=(8, 3, 0))}
edx.devstack-olive.master.studio   | test_event:  {'signal': <OpenEdxPublicSignal: org.openedx.content_authoring.xblock.created.v1>, 'sender': None, 'xblock_info': XBlockData(usage_key=BlockUsageLocator(CourseLocator('demo', 'demo2', '2020', None, None), 'course_info', 'updates'), block_type='course_info', version=BlockUsageLocator(CourseLocator('demo', 'demo2', '2020', 'draft-branch', ObjectId('655e011b89ca06c615ebfe56')), 'course_info', 'updates')), 'metadata': EventsMetadata(event_type='org.openedx.content_authoring.xblock.created.v1', id=UUID('7fb4138c-893a-11ee-a5a4-0242ac130010'), minorversion=0, source='openedx/cms/web', sourcehost='studio.devstack.edx', time=datetime.datetime(2023, 11, 22, 13, 24, 43, 867932, tzinfo=datetime.timezone.utc), sourcelib=(8, 3, 0))}
  1. Now create a CCX, the signal should be like a course created

Jira issue

Other information

Reference PR edx-platform: openedx#32599
Reference PR openedx/events: openedx/openedx-events#244

@JuanDavidBuitrago JuanDavidBuitrago force-pushed the vue/PADV-806-course-created branch from 2c74354 to d41f87a Compare November 27, 2023 20:22
@JuanDavidBuitrago JuanDavidBuitrago deleted the vue/PADV-806-course-created branch November 27, 2023 21:34
@JuanDavidBuitrago JuanDavidBuitrago restored the vue/PADV-806-course-created branch November 27, 2023 21:43
@JuanDavidBuitrago JuanDavidBuitrago self-assigned this Nov 27, 2023
@JuanDavidBuitrago JuanDavidBuitrago marked this pull request as ready for review November 27, 2023 22:03
xmodule/modulestore/tests/test_mixed_modulestore.py Outdated Show resolved Hide resolved
xmodule/modulestore/tests/test_mixed_modulestore.py Outdated Show resolved Hide resolved
xmodule/modulestore/tests/test_mixed_modulestore.py Outdated Show resolved Hide resolved
Copy link

@Jacatove Jacatove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuanDavidBuitrago CCX creation does not trigger this event!

lms/djangoapps/ccx/views.py Outdated Show resolved Hide resolved
lms/djangoapps/ccx/views.py Outdated Show resolved Hide resolved
lms/djangoapps/ccx/views.py Outdated Show resolved Hide resolved
lms/djangoapps/ccx/views.py Outdated Show resolved Hide resolved
@JuanDavidBuitrago JuanDavidBuitrago force-pushed the vue/PADV-806-course-created branch from 27b2874 to 9bb85f6 Compare November 30, 2023 00:04
@JuanDavidBuitrago JuanDavidBuitrago changed the title feat: add course created event signals PADV-806: feat: add course created event signals Nov 30, 2023
@JuanDavidBuitrago JuanDavidBuitrago merged commit 43633ed into pearson-release/olive.stage Nov 30, 2023
5 of 35 checks passed
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.

3 participants