MOBILE-3833 course: Fix conflict with automatic scrolls

main
Dani Palou 2022-04-21 08:55:26 +02:00
parent fff702edab
commit 785d8390e8
1 changed files with 6 additions and 4 deletions

View File

@ -509,12 +509,14 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy {
const moduleIdToScroll = this.moduleId && previousValue === undefined ? this.moduleId : moduleId; const moduleIdToScroll = this.moduleId && previousValue === undefined ? this.moduleId : moduleId;
if (moduleIdToScroll) { if (moduleIdToScroll) {
this.scrollToModule(moduleIdToScroll); this.scrollToModule(moduleIdToScroll);
} else { }
if (!previousValue || previousValue.id !== newSection.id) {
// First load or section changed.
if (!moduleIdToScroll) {
this.content.scrollToTop(0); this.content.scrollToTop(0);
} }
if (!previousValue || previousValue.id != newSection.id) {
// First load or section changed, add log in Moodle.
CoreUtils.ignoreErrors( CoreUtils.ignoreErrors(
CoreCourse.logView(this.course.id, newSection.section, undefined, this.course.fullname), CoreCourse.logView(this.course.id, newSection.section, undefined, this.course.fullname),
); );