Skip to content

Commit

Permalink
chore: Add video_usage_key to video microlearning segment events (#1191)
Browse files Browse the repository at this point in the history
  • Loading branch information
macdiesel committed Sep 17, 2024
1 parent f1887e4 commit 0eca5f7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/microlearning/VideoDetailPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const VideoDetailPage = () => {
video: videoData?.videoUrl,
courseKey: videoData?.courseKey,
title: videoData?.courseTitle,
video_usage_key: videoData?.videoUsageKey,
},
);
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand All @@ -81,6 +82,7 @@ const VideoDetailPage = () => {
video: videoData?.videoUrl,
courseKey: videoData?.courseKey,
title: videoData?.courseTitle,
video_usage_key: videoData?.videoUsageKey,
},
);
};
Expand Down
1 change: 1 addition & 0 deletions src/components/microlearning/data/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const transformVideoData = (data) => ({
videoDuration: formatDuration(data?.json_metadata?.duration),
institutionLogo: data?.parent_content_metadata?.logo_image_urls[0],
courseKey: data?.parent_content_metadata?.parent_content_key,
videoUsageKey: data?.video_usage_key,
});

export const getLevelType = (intl, level) => {
Expand Down
2 changes: 2 additions & 0 deletions src/components/microlearning/data/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ describe('Microlearning utils tests', () => {
subcategory: { name: 'Subcategory 1' },
},
],
video_usage_key: 'block-v1:InSendItx+WeTrustx+2T2024+type@video+block@86753094ab4b62be73e7188934982e',
};

it('should format 60 seconds correctly', () => {
Expand Down Expand Up @@ -82,6 +83,7 @@ describe('Microlearning utils tests', () => {
videoDuration: '2:03',
institutionLogo: 'http://example.com/logo.png',
courseKey: 'course-key',
videoUsageKey: 'block-v1:InSendItx+WeTrustx+2T2024+type@video+block@86753094ab4b62be73e7188934982e',
});
});

Expand Down
6 changes: 6 additions & 0 deletions src/components/microlearning/tests/VideoDetailPage.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const VIDEO_MOCK_DATA = {
videoUrl: 'test-video-url.mp4',
institutionLogo: 'test-institution-logo.png',
courseKey: 'test-course-key',
videoUsageKey: 'block-v1:InSendItx+WeTrustx+2T2024+type@video+block@86753094ab4b62be73e7188934982e',
};
const mockEnterpriseCustomer = enterpriseCustomerFactory();
const mockAuthenticatedUser = authenticatedUserFactory();
Expand Down Expand Up @@ -157,6 +158,7 @@ describe('VideoDetailPage Tests', () => {
video: VIDEO_MOCK_DATA.videoUrl,
courseKey: VIDEO_MOCK_DATA.courseKey,
title: VIDEO_MOCK_DATA.courseTitle,
video_usage_key: VIDEO_MOCK_DATA.videoUsageKey,
},
);
});
Expand Down Expand Up @@ -211,6 +213,7 @@ describe('VideoDetailPage Tests', () => {
video: VIDEO_MOCK_DATA.videoUrl,
courseKey: VIDEO_MOCK_DATA.courseKey,
title: VIDEO_MOCK_DATA.courseTitle,
video_usage_key: VIDEO_MOCK_DATA.videoUsageKey,
},
);
});
Expand All @@ -227,6 +230,7 @@ describe('VideoDetailPage Tests', () => {
video: VIDEO_MOCK_DATA.videoUrl,
courseKey: VIDEO_MOCK_DATA.courseKey,
title: VIDEO_MOCK_DATA.courseTitle,
video_usage_key: VIDEO_MOCK_DATA.videoUsageKey,
},
);
});
Expand All @@ -244,6 +248,7 @@ describe('VideoDetailPage Tests', () => {
video: VIDEO_MOCK_DATA.videoUrl,
courseKey: VIDEO_MOCK_DATA.courseKey,
title: VIDEO_MOCK_DATA.courseTitle,
video_usage_key: VIDEO_MOCK_DATA.videoUsageKey,
},
);
});
Expand All @@ -261,6 +266,7 @@ describe('VideoDetailPage Tests', () => {
video: VIDEO_MOCK_DATA.videoUrl,
courseKey: VIDEO_MOCK_DATA.courseKey,
title: VIDEO_MOCK_DATA.courseTitle,
video_usage_key: VIDEO_MOCK_DATA.videoUsageKey,
},
);
});
Expand Down

0 comments on commit 0eca5f7

Please sign in to comment.