From 98c4eba988028757a2934f89cdb50c47b1307763 Mon Sep 17 00:00:00 2001 From: dpalou Date: Mon, 15 Oct 2018 11:33:35 +0200 Subject: [PATCH] MOBILE-2502 course: Don't get sections using cache key --- src/core/course/providers/course.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/core/course/providers/course.ts b/src/core/course/providers/course.ts index 0e3570574..6af2d73f3 100644 --- a/src/core/course/providers/course.ts +++ b/src/core/course/providers/course.ts @@ -516,7 +516,6 @@ export class CoreCourseProvider { return this.sitesProvider.getSite(siteId).then((site) => { preSets = preSets || {}; preSets.cacheKey = this.getSectionsCacheKey(courseId); - preSets.getCacheUsingCacheKey = true; // This is to make sure users don't lose offline access when updating. const params = { courseid: courseId, @@ -536,7 +535,14 @@ export class CoreCourseProvider { ] }; - return site.read('core_course_get_contents', params, preSets).then((sections) => { + return site.read('core_course_get_contents', params, preSets).catch(() => { + // Error getting the data, it could fail because we added a new parameter and the call isn't cached. + // Retry without the new parameter and forcing cache. + preSets.omitExpires = true; + params.options.splice(-1, 1); + + return site.read('core_course_get_contents', params, preSets); + }).then((sections) => { const siteHomeId = site.getSiteHomeId(); let showSections = true;