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

fix: use latest xapi base MV definition (FC-0033) #38

Merged
merged 1 commit into from
Dec 18, 2023
Merged
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
25 changes: 18 additions & 7 deletions models/base/xapi_events_all_parsed.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,26 @@ SELECT
JSON_VALUE(event_str, '$.actor.mbox_sha1sum')
) as actor_id,
JSON_VALUE(event_str, '$.object.id') as object_id,
-- If the contextActivities parent is a course, use that. Otherwise use the object id for the course id
if(
-- If the contextActivities parent is a course, use that. It can be a "course"
-- type, or a "cmi.interaction" type for multiple question problem submissions.
-- Otherwise use the object id for the course id.
multiIf(
-- If the contextActivities parent is a course, use that
JSON_VALUE(
event_str,
'$.context.contextActivities.parent[0].definition.type')
= 'http://adlnet.gov/expapi/activities/course',
JSON_VALUE(event_str, '$.context.contextActivities.parent[0].id'),
JSON_VALUE(event_str, '$.object.id')
) as course_id,
'$.context.contextActivities.parent[0].definition.type'
) = 'http://adlnet.gov/expapi/activities/course',
JSON_VALUE(event_str, '$.context.contextActivities.parent[0].id'),
-- Else if the contextActivities parent is a GroupActivity, it's a multi
-- question problem and we use the grouping id
JSON_VALUE(
event_str,
'$.context.contextActivities.parent[0].objectType'
) in ('Activity', 'GroupActivity'),
JSON_VALUE(event_str, '$.context.contextActivities.grouping[0].id'),
-- Otherwise use the object id
JSON_VALUE(event_str, '$.object.id')
) as course_id,
coalesce(get_org_from_course_url(course_id), '') as org,
emission_time as emission_time,
event_str as event_str
Expand Down