Skip to content

Commit ce87157

Browse files
Merge pull request #4213 from crazyserver/MOBILE-4616
MOBILE-4616 course: Expand subsections of last viewed module
2 parents cd848c5 + 0bcf7ad commit ce87157

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/core/features/course/components/course-format/course-format.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,10 +403,23 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy {
403403
this.viewedModules[entry.cmId] = true;
404404
});
405405

406-
const lastViewedSection = this.getViewedModuleSection();
407-
if (lastViewedSection) {
408-
this.setSectionExpanded(lastViewedSection);
406+
if (!this.lastModuleViewed) {
407+
return;
409408
}
409+
410+
// Expand section and subsection of the last viewed module.
411+
const { section, parents } = CoreCourseHelper.findSection(this.sections, {
412+
id: this.lastModuleViewed.sectionId,
413+
moduleId: this.lastModuleViewed.cmId,
414+
});
415+
416+
if (section) {
417+
parents.push(section);
418+
}
419+
parents.filter(section => section.id !== this.stealthModulesSectionId)
420+
.forEach(section => {
421+
this.setSectionExpanded(section);
422+
});
410423
}
411424

412425
/**

0 commit comments

Comments
 (0)