Merge pull request #4213 from crazyserver/MOBILE-4616

MOBILE-4616 course: Expand subsections of last viewed module
main
Alfonso Salces 2024-10-17 11:49:21 +02:00 committed by GitHub
commit ce87157622
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 3 deletions

View File

@ -403,10 +403,23 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy {
this.viewedModules[entry.cmId] = true; this.viewedModules[entry.cmId] = true;
}); });
const lastViewedSection = this.getViewedModuleSection(); if (!this.lastModuleViewed) {
if (lastViewedSection) { return;
this.setSectionExpanded(lastViewedSection);
} }
// Expand section and subsection of the last viewed module.
const { section, parents } = CoreCourseHelper.findSection(this.sections, {
id: this.lastModuleViewed.sectionId,
moduleId: this.lastModuleViewed.cmId,
});
if (section) {
parents.push(section);
}
parents.filter(section => section.id !== this.stealthModulesSectionId)
.forEach(section => {
this.setSectionExpanded(section);
});
} }
/** /**