diff --git a/resources/vue/components/courseware/CoursewareListContainer.vue b/resources/vue/components/courseware/CoursewareListContainer.vue index 91947de5fb43642b747671bf4656ebbd14b193ec..8e889f86c8692712f21cc36d10049cc717517978 100644 --- a/resources/vue/components/courseware/CoursewareListContainer.vue +++ b/resources/vue/components/courseware/CoursewareListContainer.vue @@ -79,8 +79,13 @@ export default { if (!this.container) { return []; } + let containerBlocks = this.container.relationships.blocks.data.map(({ id }) => this.blockById({ id })).filter(Boolean); + let unallocated = new Set(containerBlocks.map(({ id }) => id)); + let sortedBlocks = this.container.attributes.payload.sections[0].blocks.map((id) => this.blockById({ id })).filter(Boolean); + sortedBlocks.forEach(({ id }) => unallocated.delete(id)); + let unallocatedBlocks = [...unallocated].map((id) => this.blockById({ id })); - return this.container.relationships.blocks.data.map(({ id }) => this.blockById({ id })).filter(Boolean); + return sortedBlocks.concat(unallocatedBlocks); }, showEditMode() { return this.$store.getters.viewMode === 'edit';