Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Commit

Permalink
fix: sink ccx courses on original course published
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Feb 19, 2024
1 parent ee77357 commit b4d7b0f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions event_sink_clickhouse/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,8 @@ def plugin_settings(settings):
"module": "openedx.core.djangoapps.external_user_ids.models",
"model": "ExternalId",
},
"custom_course_edx": {
"module": "lms.djangoapps.ccx.models",
"model": "CustomCourseForEdX",
}
}
7 changes: 6 additions & 1 deletion event_sink_clickhouse/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from opaque_keys.edx.keys import CourseKey

from event_sink_clickhouse.sinks.course_published import CourseOverviewSink
from event_sink_clickhouse.sinks.user_profile_sink import UserProfileSink
from event_sink_clickhouse.utils import get_ccx_courses

log = logging.getLogger(__name__)
celery_log = logging.getLogger("edx.celery.task")
Expand All @@ -32,6 +32,11 @@ def dump_course_to_clickhouse(course_key_string, connection_overrides=None):
sink = CourseOverviewSink(connection_overrides=connection_overrides, log=celery_log)
sink.dump(course_key)

ccx_courses = get_ccx_courses(course_key)
for ccx_course in ccx_courses:
ccx_course_key = str(ccx_course.locator)
sink.dump(ccx_course_key)


@shared_task
@set_code_owner_attribute
Expand Down
9 changes: 9 additions & 0 deletions event_sink_clickhouse/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,12 @@ def get_detached_xblock_types(): # pragma: no cover
from xmodule.modulestore.store_utilities import DETACHED_XBLOCK_TYPES

return DETACHED_XBLOCK_TYPES


def get_ccx_courses(course_id):
"""
Get the CCX courses for a given course.
"""
if settings.FEATURES.get("CUSTOM_COURSES_EDX"):
return get_model("custom_course_edx").objects.filter(course_id=course_id)
return []

0 comments on commit b4d7b0f

Please sign in to comment.