diff --git a/resources/vue/components/courseware/unit/CoursewareShelfDialogImport.vue b/resources/vue/components/courseware/unit/CoursewareShelfDialogImport.vue index bf32addb0995f1e33eb9671abc2dc4facf402424..c7f67cdde45ad52afbdb4c824c9fc08d317345b4 100644 --- a/resources/vue/components/courseware/unit/CoursewareShelfDialogImport.vue +++ b/resources/vue/components/courseware/unit/CoursewareShelfDialogImport.vue @@ -351,6 +351,7 @@ export default { } } }; + this.sortChildren(this.loadedZipData.courseware.children); await this.createCoursewareUnit(unit, { root: true }); const newElementId = this.lastCreateCoursewareUnit.relationships['structural-element'].data.id; await this.loadStructuralElementById({ id: newElementId }); @@ -371,6 +372,14 @@ export default { this.requirements.push({slot: slot, text: text}); } } + }, + sortChildren(children) { + children?.sort((a, b) => { + return a.attributes.position - b.attributes.position; + }); + children?.forEach(child => { + this.sortChildren(child.children); + }); } } }