feat: stop calling course blocks rest API and assume LS exists (#803)
- Assume that Learning Sequences is available (waffle has been removed) - Stop calling course blocks API, which provided mostly duplicated information now. - Refactor a bit to avoid needing to globally know which units exist in sequences. That is now provided just-in-time for only the current sequence. - Add /first and /last URLs that you can use instead of unit IDs in URL paths, in service of the above point. AA-1040 AA-1153
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import { Factory } from 'rosie'; // eslint-disable-line import/no-extraneous-dependencies
|
||||
import './block.factory';
|
||||
|
||||
// Most of this file can be removed at some point, now that we rarely use course blocks
|
||||
// in favor of learning sequences. But for now, these are mostly used to then feed into
|
||||
// buildOutlineFromBlocks, which is an awkward flow if we don't really care about the
|
||||
// course blocks themselves. A future cleanup to do.
|
||||
|
||||
// Generates an Array of block IDs, either from a single block or an array of blocks.
|
||||
const getIds = (attr) => {
|
||||
const blocks = Array.isArray(attr) ? attr : [attr];
|
||||
@@ -84,7 +89,7 @@ export function buildSimpleCourseBlocks(courseId, title, options = {}) {
|
||||
{
|
||||
courseId,
|
||||
hasScheduledContent: options.hasScheduledContent || false,
|
||||
title: 'Demo Course',
|
||||
title,
|
||||
},
|
||||
{
|
||||
units: unitBlocks,
|
||||
@@ -225,7 +230,7 @@ export function buildBinaryCourseBlocks(courseId, title) {
|
||||
// work with.
|
||||
courseBlocks: Factory.build(
|
||||
'courseBlocks',
|
||||
{ courseId },
|
||||
{ courseId, title },
|
||||
{
|
||||
units: unitBlocks,
|
||||
sequences: sequenceBlocks,
|
||||
|
||||
Reference in New Issue
Block a user