Merge pull request #4035 from dpalou/MOBILE-4470
MOBILE-4470 course: Show all sections if last module is stealthmain
commit
c2a16b66a2
|
@ -382,18 +382,18 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy {
|
|||
sections: CoreCourseSection[],
|
||||
viewedModule: CoreCourseViewedModulesDBRecord,
|
||||
): CoreCourseSection | undefined {
|
||||
let lastModuleSection: CoreCourseSection | undefined;
|
||||
|
||||
if (viewedModule.sectionId) {
|
||||
const lastModuleSection = sections.find(section => section.id === viewedModule.sectionId);
|
||||
|
||||
if (lastModuleSection) {
|
||||
return lastModuleSection;
|
||||
}
|
||||
lastModuleSection = sections.find(section => section.id === viewedModule.sectionId);
|
||||
}
|
||||
|
||||
if (!lastModuleSection) {
|
||||
// No sectionId or section not found. Search the module.
|
||||
return sections.find(
|
||||
section => section.modules.some(module => module.id === viewedModule.cmId),
|
||||
);
|
||||
lastModuleSection = sections.find(section => section.modules.some(module => module.id === viewedModule.cmId));
|
||||
}
|
||||
|
||||
return lastModuleSection && lastModuleSection.id !== this.stealthModulesSectionId ? lastModuleSection : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue