MOBILE-2675 offline: Ignore errors when logging actions

main
Albert Gasset 2018-10-29 15:55:33 +01:00
parent d2c82f25dd
commit 5b403129cd
21 changed files with 57 additions and 10 deletions

View File

@ -54,9 +54,14 @@ export class AddonCompetencyCompetencyPage {
ionViewDidLoad(): void {
this.fetchCompetency().then(() => {
if (this.planId) {
this.competencyProvider.logCompetencyInPlanView(this.planId, this.competencyId, this.planStatus, this.userId);
this.competencyProvider.logCompetencyInPlanView(this.planId, this.competencyId, this.planStatus, this.userId)
.catch(() => {
// Ignore errors.
});
} else {
this.competencyProvider.logCompetencyInCourseView(this.courseId, this.competencyId, this.userId);
this.competencyProvider.logCompetencyInCourseView(this.courseId, this.competencyId, this.userId).catch(() => {
// Ignore errors.
});
}
}).finally(() => {
this.competencyLoaded = true;

View File

@ -41,7 +41,9 @@ export class AddonCompetencyCompetencySummaryPage {
*/
ionViewDidLoad(): void {
this.fetchCompetency().then(() => {
this.competencyProvider.logCompetencyView(this.competencyId);
this.competencyProvider.logCompetencyView(this.competencyId).catch(() => {
// Ignore errors.
});
}).finally(() => {
this.competencyLoaded = true;
});

View File

@ -168,6 +168,8 @@ export class AddonModBookIndexComponent extends CoreCourseModuleMainResourceComp
if (!this.nextChapter) {
this.courseProvider.checkModuleCompletion(this.courseId, this.module.completionstatus);
}
}).catch(() => {
// Ignore errors.
});
}).catch((error) => {
this.domUtils.showErrorModalDefault(error, 'addon.mod_book.errorchapter', true);

View File

@ -49,6 +49,8 @@ export class AddonModChatIndexComponent extends CoreCourseModuleMainActivityComp
this.loadContent().then(() => {
this.chatProvider.logView(this.chat.id).then(() => {
this.courseProvider.checkModuleCompletion(this.courseId, this.module.completionstatus);
}).catch(() => {
// Ignore errors.
});
});
}

View File

@ -105,6 +105,8 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
this.dataProvider.logView(this.data.id).then(() => {
this.courseProvider.checkModuleCompletion(this.courseId, this.module.completionstatus);
}).catch(() => {
// Ignore errors.
});
});

View File

@ -97,7 +97,9 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity
super.ngOnInit();
this.loadContent(false, true).then(() => {
this.feedbackProvider.logView(this.feedback.id);
this.feedbackProvider.logView(this.feedback.id).catch(() => {
// Ignore errors.
});
}).finally(() => {
this.tabsReady = true;
});

View File

@ -96,6 +96,8 @@ export class AddonModFeedbackFormPage implements OnDestroy {
this.fetchData().then(() => {
this.feedbackProvider.logView(this.feedback.id, true).then(() => {
this.courseProvider.checkModuleCompletion(this.courseId, this.module.completionstatus);
}).catch(() => {
// Ignore errors.
});
});
}

View File

@ -57,6 +57,8 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo
this.loadContent().then(() => {
this.folderProvider.logView(this.module.instance).then(() => {
this.courseProvider.checkModuleCompletion(this.courseId, this.module.completionstatus);
}).catch(() => {
// Ignore errors.
});
}).finally(() => {
this.loaded = true;

View File

@ -48,7 +48,9 @@ export class AddonModGlossaryEntryPage {
*/
ionViewDidLoad(): void {
this.fetchEntry().then(() => {
this.glossaryProvider.logEntryView(this.entry.id);
this.glossaryProvider.logEntryView(this.entry.id).catch(() => {
// Ignore errors.
});
}).finally(() => {
this.loaded = true;
});

View File

@ -54,6 +54,8 @@ export class AddonModImscpIndexComponent extends CoreCourseModuleMainResourceCom
this.loadContent().then(() => {
this.imscpProvider.logView(this.module.instance).then(() => {
this.courseProvider.checkModuleCompletion(this.courseId, this.module.completionstatus);
}).catch(() => {
// Ignore errors.
});
});
}

View File

@ -55,6 +55,8 @@ export class AddonModPageIndexComponent extends CoreCourseModuleMainResourceComp
this.loadContent().then(() => {
this.pageProvider.logView(this.module.instance).then(() => {
this.courseProvider.checkModuleCompletion(this.courseId, this.module.completionstatus);
}).catch(() => {
// Ignore errors.
});
});
}

View File

@ -52,6 +52,8 @@ export class AddonModResourceIndexComponent extends CoreCourseModuleMainResource
this.loadContent().then(() => {
this.resourceProvider.logView(this.module.instance).then(() => {
this.courseProvider.checkModuleCompletion(this.courseId, this.module.completionstatus);
}).catch(() => {
// Ignore errors.
});
});
}

View File

@ -154,6 +154,8 @@ export class AddonModResourceHelperProvider {
module.contents).then(() => {
this.resourceProvider.logView(module.instance).then(() => {
this.courseProvider.checkModuleCompletion(courseId, module.completionstatus);
}).catch(() => {
// Ignore errors.
});
}).catch((error) => {
this.domUtils.showErrorModalDefault(error, 'addon.mod_resource.errorwhileloadingthecontent', true);

View File

@ -55,6 +55,8 @@ export class AddonModSurveyIndexComponent extends CoreCourseModuleMainActivityCo
this.loadContent(false, true).then(() => {
this.surveyProvider.logView(this.survey.id).then(() => {
this.courseProvider.checkModuleCompletion(this.courseId, this.module.completionstatus);
}).catch(() => {
// Ignore errors.
});
});
}

View File

@ -173,6 +173,8 @@ export class AddonModUrlIndexComponent extends CoreCourseModuleMainResourceCompo
go(): void {
this.urlProvider.logView(this.module.instance).then(() => {
this.courseProvider.checkModuleCompletion(this.courseId, this.module.completionstatus);
}).catch(() => {
// Ignore errors.
});
this.urlHelper.open(this.url);
}

View File

@ -164,6 +164,8 @@ export class AddonModUrlModuleHandler implements CoreCourseModuleHandler {
protected openUrl(module: any, courseId: number): void {
this.urlProvider.logView(module.instance).then(() => {
this.courseProvider.checkModuleCompletion(courseId, module.completionstatus);
}).catch(() => {
// Ignore errors.
});
this.urlHelper.open(module.contents[0].fileurl);
}

View File

@ -341,7 +341,9 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp
this.currentPage = data.pageId;
this.showLoadingAndFetch(true, false).then(() => {
this.wikiProvider.logPageView(this.currentPage);
this.wikiProvider.logPageView(this.currentPage).catch(() => {
// Ignore errors.
});
});
// Stop listening for new page events.

View File

@ -132,6 +132,8 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy {
this.fetchSubmissionData().then(() => {
this.workshopProvider.logViewSubmission(this.submissionId).then(() => {
this.courseProvider.checkModuleCompletion(this.courseId, this.module.completionstatus);
}).catch(() => {
// Ignore errors.
});
});
}

View File

@ -67,7 +67,9 @@ export class AddonNotesListComponent implements OnInit, OnDestroy {
*/
ngOnInit(): void {
this.fetchNotes(true).then(() => {
this.notesProvider.logView(this.courseId);
this.notesProvider.logView(this.courseId).catch(() => {
// Ignore errors.
});
});
}
@ -128,7 +130,9 @@ export class AddonNotesListComponent implements OnInit, OnDestroy {
this.refreshIcon = 'spinner';
this.syncIcon = 'spinner';
this.fetchNotes(true).then(() => {
this.notesProvider.logView(this.courseId);
this.notesProvider.logView(this.courseId).catch(() => {
// Ignore errors.
});
});
}

View File

@ -53,7 +53,9 @@ export class CoreGradesCourseComponent {
}
// Add log in Moodle.
return this.gradesProvider.logCourseGradesView(this.courseId, this.userId);
return this.gradesProvider.logCourseGradesView(this.courseId, this.userId).catch(() => {
// Ignore errors.
});
}).finally(() => {
this.gradesLoaded = true;
});

View File

@ -55,7 +55,9 @@ export class CoreGradesCoursesPage {
}
// Add log in Moodle.
return this.gradesProvider.logCoursesGradesView();
return this.gradesProvider.logCoursesGradesView().catch(() => {
// Ignore errors.
});
}).finally(() => {
this.gradesLoaded = true;
});