MOBILE-2735 course: Log view when changing sections

main
Dani Palou 2019-06-26 08:58:48 +02:00
parent dc5b9875b3
commit b302ea0d5a
2 changed files with 9 additions and 6 deletions

View File

@ -82,7 +82,8 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy {
constructor(private cfDelegate: CoreCourseFormatDelegate, translate: TranslateService, private injector: Injector,
private courseHelper: CoreCourseHelperProvider, private domUtils: CoreDomUtilsProvider,
eventsProvider: CoreEventsProvider, private sitesProvider: CoreSitesProvider, private content: Content,
prefetchDelegate: CoreCourseModulePrefetchDelegate, private modalCtrl: ModalController) {
prefetchDelegate: CoreCourseModulePrefetchDelegate, private modalCtrl: ModalController,
private courseProvider: CoreCourseProvider) {
this.selectOptions.title = translate.instant('core.course.sections');
this.completionChanged = new EventEmitter();
@ -335,6 +336,13 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy {
} else {
this.domUtils.scrollToTop(this.content, 0);
}
if (!previousValue || previousValue.id != newSection.id) {
// First load or section changed, add log in Moodle.
this.courseProvider.logView(this.course.id, newSection.section, undefined, this.course.fullname).catch(() => {
// Ignore errors.
});
}
}
/**

View File

@ -234,11 +234,6 @@ export class CoreCourseSectionPage implements OnDestroy {
}).then((sections) => {
let promise;
// Add log in Moodle.
this.courseProvider.logView(this.course.id, this.sectionNumber, undefined, this.course.fullname).catch(() => {
// Ignore errors.
});
// Get the completion status.
if (this.course.enablecompletion === false) {
// Completion not enabled.