Allow loading with no unit, and of sequences with no unitIds. (#34)

This requires some defensive programming here and there to let things load in a minimal state.
This commit is contained in:
David Joy
2020-03-23 16:40:50 -04:00
committed by GitHub
parent 781508dd03
commit c8be4c401f
4 changed files with 37 additions and 21 deletions

View File

@@ -41,14 +41,14 @@ function normalizeBlocks(courseUsageKey, blocks) {
models.courses[block.id] = {
id: courseUsageKey,
title: block.display_name,
sectionIds: block.children,
sectionIds: block.children || [],
};
break;
case 'chapter':
models.sections[block.id] = {
id: block.id,
title: block.display_name,
sequenceIds: block.children,
sequenceIds: block.children || [],
};
break;
@@ -57,7 +57,7 @@ function normalizeBlocks(courseUsageKey, blocks) {
id: block.id,
title: block.display_name,
lmsWebUrl: block.lms_web_url,
unitIds: block.children,
unitIds: block.children || [],
};
break;
case 'vertical':