feat: use learning sequences even when masquerading (#774)

The backend recently grew support for it, so we can use it
directly instead of falling back to course blocks in that case.

AA-1151
This commit is contained in:
Michael Terry
2021-12-20 13:19:38 -05:00
committed by GitHub
parent aaf2856573
commit 1044d2afc6

View File

@@ -37,13 +37,11 @@ import {
* *
* @param {*} learningSequencesModels Normalized model from normalizeLearningSequencesData * @param {*} learningSequencesModels Normalized model from normalizeLearningSequencesData
* @param {*} courseBlocksModels Normalized model from normalizeBlocks * @param {*} courseBlocksModels Normalized model from normalizeBlocks
* @param {bool} isMasquerading Is Masquerading being used?
*/ */
function mergeLearningSequencesWithCourseBlocks(learningSequencesModels, courseBlocksModels, isMasquerading) { function mergeLearningSequencesWithCourseBlocks(learningSequencesModels, courseBlocksModels) {
// If there's no Learning Sequences API data yet (not active for this course), // If there's no Learning Sequences API data yet (not active for this course),
// send back the course blocks model as-is. Likewise, Learning Sequences // send back the course blocks model as-is.
// doesn't currently handle masquerading properly for content groups. if (learningSequencesModels === null) {
if (isMasquerading || learningSequencesModels === null) {
return courseBlocksModels; return courseBlocksModels;
} }
const mergedModels = { const mergedModels = {
@@ -151,7 +149,6 @@ export function fetchCourse(courseId) {
} = mergeLearningSequencesWithCourseBlocks( } = mergeLearningSequencesWithCourseBlocks(
learningSequencesOutlineResult.value, learningSequencesOutlineResult.value,
courseBlocksResult.value, courseBlocksResult.value,
courseMetadataResult.value.isMasquerading,
); );
// This updates the course with a sectionIds array from the blocks data. // This updates the course with a sectionIds array from the blocks data.