Skip to content

Commit

Permalink
Merge pull request #4213 from crazyserver/MOBILE-4616
Browse files Browse the repository at this point in the history
MOBILE-4616 course: Expand subsections of last viewed module
  • Loading branch information
alfonso-salces authored Oct 17, 2024
2 parents cd848c5 + 0bcf7ad commit ce87157
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/core/features/course/components/course-format/course-format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,23 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy {
this.viewedModules[entry.cmId] = true;
});

const lastViewedSection = this.getViewedModuleSection();
if (lastViewedSection) {
this.setSectionExpanded(lastViewedSection);
if (!this.lastModuleViewed) {
return;
}

// 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);
});
}

/**
Expand Down

0 comments on commit ce87157

Please sign in to comment.