diff --git a/src/addon/mod/assign/providers/assign.ts b/src/addon/mod/assign/providers/assign.ts index a1e3a329a..14568639c 100644 --- a/src/addon/mod/assign/providers/assign.ts +++ b/src/addon/mod/assign/providers/assign.ts @@ -136,13 +136,20 @@ export class AddonModAssignProvider { protected getAssignmentByField(courseId: number, key: string, value: any, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { const params = { - courseids: [courseId] + courseids: [courseId], + includenotenrolledcourses: 1 }, preSets = { cacheKey: this.getAssignmentCacheKey(courseId) }; - return site.read('mod_assign_get_assignments', params, preSets).then((response) => { + return site.read('mod_assign_get_assignments', params, preSets).catch(() => { + // In 3.6 we added a new parameter includenotenrolledcourses that could cause offline data not to be found. + // Retry again without the param to check if the request is already cached. + delete params.includenotenrolledcourses; + + return site.read('mod_assign_get_assignments', params, preSets); + }).then((response) => { // Search the assignment to return. if (response.courses && response.courses.length) { const assignments = response.courses[0].assignments;