Merge pull request #1796 from dpalou/MOBILE-2850

MOBILE-2850 course: Fix prefetch after sync for some activities
main
Juan Leyva 2019-03-07 11:37:18 +01:00 committed by GitHub
commit 4015641ee5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 8 deletions

View File

@ -43,7 +43,7 @@ export class AddonModChoiceSyncProvider extends CoreCourseActivitySyncBaseProvid
protected appProvider: CoreAppProvider, private choiceOffline: AddonModChoiceOfflineProvider,
private eventsProvider: CoreEventsProvider, private choiceProvider: AddonModChoiceProvider,
translate: TranslateService, private utils: CoreUtilsProvider, protected textUtils: CoreTextUtilsProvider,
courseProvider: CoreCourseProvider, syncProvider: CoreSyncProvider, timeUtils: CoreTimeUtilsProvider,
private courseProvider: CoreCourseProvider, syncProvider: CoreSyncProvider, timeUtils: CoreTimeUtilsProvider,
private logHelper: CoreCourseLogHelperProvider, prefetchHandler: AddonModChoicePrefetchHandler,
prefetchDelegate: CoreCourseModulePrefetchDelegate) {
@ -200,7 +200,9 @@ export class AddonModChoiceSyncProvider extends CoreCourseActivitySyncBaseProvid
}).then(() => {
if (courseId) {
// Data has been sent to server, prefetch choice if needed.
return this.prefetchAfterUpdate(module, courseId, undefined, siteId).catch(() => {
return this.courseProvider.getModuleBasicInfoByInstance(choiceId, 'choice', siteId).then((module) => {
return this.prefetchAfterUpdate(module, courseId, undefined, siteId);
}).catch(() => {
// Ignore errors.
});
}

View File

@ -43,7 +43,7 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv
protected appProvider: CoreAppProvider, private feedbackOffline: AddonModFeedbackOfflineProvider,
private eventsProvider: CoreEventsProvider, private feedbackProvider: AddonModFeedbackProvider,
protected translate: TranslateService, private utils: CoreUtilsProvider, protected textUtils: CoreTextUtilsProvider,
courseProvider: CoreCourseProvider, syncProvider: CoreSyncProvider, timeUtils: CoreTimeUtilsProvider,
private courseProvider: CoreCourseProvider, syncProvider: CoreSyncProvider, timeUtils: CoreTimeUtilsProvider,
private logHelper: CoreCourseLogHelperProvider, prefetchDelegate: CoreCourseModulePrefetchDelegate,
prefetchHandler: AddonModFeedbackPrefetchHandler) {
@ -236,7 +236,9 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv
}).then(() => {
if (result.updated) {
// Data has been sent to server, update data.
return this.prefetchAfterUpdate(module, courseId, undefined, siteId).catch(() => {
return this.courseProvider.getModuleBasicInfoByInstance(feedbackId, 'feedback', siteId).then((module) => {
return this.prefetchAfterUpdate(module, courseId, undefined, siteId);
}).catch(() => {
// Ignore errors.
});
}

View File

@ -91,7 +91,7 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid
constructor(loggerProvider: CoreLoggerProvider, sitesProvider: CoreSitesProvider, appProvider: CoreAppProvider,
syncProvider: CoreSyncProvider, textUtils: CoreTextUtilsProvider, translate: TranslateService,
courseProvider: CoreCourseProvider, private eventsProvider: CoreEventsProvider,
private courseProvider: CoreCourseProvider, private eventsProvider: CoreEventsProvider,
private lessonProvider: AddonModLessonProvider, private lessonOfflineProvider: AddonModLessonOfflineProvider,
protected prefetchHandler: AddonModLessonPrefetchHandler, timeUtils: CoreTimeUtilsProvider,
private utils: CoreUtilsProvider, private urlUtils: CoreUrlUtilsProvider,
@ -431,7 +431,9 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid
}).then(() => {
if (result.updated && courseId) {
// Data has been sent to server, update data.
return this.prefetchAfterUpdate(module, courseId, undefined, siteId).catch(() => {
return this.courseProvider.getModuleBasicInfoByInstance(lessonId, 'lesson', siteId).then((module) => {
return this.prefetchAfterUpdate(module, courseId, undefined, siteId);
}).catch(() => {
// Ignore errors.
});
}

View File

@ -41,7 +41,7 @@ export class AddonModSurveySyncProvider extends CoreCourseActivitySyncBaseProvid
constructor(loggerProvider: CoreLoggerProvider, sitesProvider: CoreSitesProvider, appProvider: CoreAppProvider,
syncProvider: CoreSyncProvider, textUtils: CoreTextUtilsProvider, translate: TranslateService,
courseProvider: CoreCourseProvider, private surveyOffline: AddonModSurveyOfflineProvider,
private courseProvider: CoreCourseProvider, private surveyOffline: AddonModSurveyOfflineProvider,
private eventsProvider: CoreEventsProvider, private surveyProvider: AddonModSurveyProvider,
private utils: CoreUtilsProvider, timeUtils: CoreTimeUtilsProvider, private logHelper: CoreCourseLogHelperProvider,
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModSurveyPrefetchHandler) {
@ -195,7 +195,9 @@ export class AddonModSurveySyncProvider extends CoreCourseActivitySyncBaseProvid
}).then(() => {
if (courseId) {
// Data has been sent to server, update survey data.
return this.prefetchAfterUpdate(module, courseId, undefined, siteId).catch(() => {
return this.courseProvider.getModuleBasicInfoByInstance(surveyId, 'survey', siteId).then((module) => {
return this.prefetchAfterUpdate(module, courseId, undefined, siteId);
}).catch(() => {
// Ignore errors.
});
}