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[],
|
sections: CoreCourseSection[],
|
||||||
viewedModule: CoreCourseViewedModulesDBRecord,
|
viewedModule: CoreCourseViewedModulesDBRecord,
|
||||||
): CoreCourseSection | undefined {
|
): CoreCourseSection | undefined {
|
||||||
if (viewedModule.sectionId) {
|
let lastModuleSection: CoreCourseSection | undefined;
|
||||||
const lastModuleSection = sections.find(section => section.id === viewedModule.sectionId);
|
|
||||||
|
|
||||||
if (lastModuleSection) {
|
if (viewedModule.sectionId) {
|
||||||
return lastModuleSection;
|
lastModuleSection = sections.find(section => section.id === viewedModule.sectionId);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// No sectionId or section not found. Search the module.
|
if (!lastModuleSection) {
|
||||||
return sections.find(
|
// No sectionId or section not found. Search the module.
|
||||||
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