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: add support for CCX courses #44

Merged
merged 3 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion macros/get_problem_id.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
-- either the problem id is at the end of the object ID
-- or is followed by '/answer' or '/hint'
{% macro get_problem_id(object_id) %}
regexpExtract(object_id, 'xblock/([\w\d-\+:]*@problem\+block@[\w\d][^_]*)(_\d_\d)?', 1)
regexpExtract(object_id, 'xblock/([\w\d-\+:@]*@problem\+block@[\w\d][^_]*)(_\d_\d)?', 1)
{% endmacro %}
2 changes: 1 addition & 1 deletion models/base/xapi_events_all_parsed.sql
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ SELECT
-- Otherwise use the object id
JSON_VALUE(event::String, '$.object.id')
) as course_id,
coalesce(get_org_from_course_url(course_id), '') as org,
coalesce(get_org_from_course_url(course_id), get_org_from_ccx_course_url(course_id), '') as org,
emission_time as emission_time,
event::String as event
FROM {{ source('xapi', 'xapi_events_all') }}
6 changes: 6 additions & 0 deletions tests/get_problem_id.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
select
'http://local.edly.io:8000/xblock/block-v1:edunext+demo+demo+ccx+type@problem+block@3c1646f7133a4c5fb4557d649e22c251' as object_id
from
system.one
where
{{ get_problem_id('object_id') }} != 'block-v1:edunext+demo+demo+ccx+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'
6 changes: 6 additions & 0 deletions tests/get_problem_id_with_ccx.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
select
'http://local.edly.io:8000/xblock/ccx-block-v1:edunext+demo+demo+ccx@1+type@problem+block@3c1646f7133a4c5fb4557d649e22c251' as object_id
from
system.one
where
{{ get_problem_id('object_id') }} != 'ccx-block-v1:edunext+demo+demo+ccx@1+type@problem+block@3c1646f7133a4c5fb4557d649e22c251'