diff --git a/src/addons/block/myoverview/components/myoverview/myoverview.ts b/src/addons/block/myoverview/components/myoverview/myoverview.ts index fa7e2f7fa..4d3a0bc78 100644 --- a/src/addons/block/myoverview/components/myoverview/myoverview.ts +++ b/src/addons/block/myoverview/components/myoverview/myoverview.ts @@ -264,8 +264,13 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem this.hasCourses = this.allCourses.length > 0; - this.gradePeriodAfter = parseInt(await this.currentSite.getConfig('coursegraceperiodafter', refresh), 10) || 0; - this.gradePeriodBefore = parseInt(await this.currentSite.getConfig('coursegraceperiodbefore', refresh), 10) || 0; + try { + this.gradePeriodAfter = parseInt(await this.currentSite.getConfig('coursegraceperiodafter', refresh), 10); + this.gradePeriodBefore = parseInt(await this.currentSite.getConfig('coursegraceperiodbefore', refresh), 10); + } catch { + this.gradePeriodAfter = 0; + this.gradePeriodBefore = 0; + } this.loadSort(); this.loadLayouts(config?.layouts?.value.split(',')); diff --git a/src/addons/block/recentlyaccessedcourses/components/recentlyaccessedcourses/recentlyaccessedcourses.ts b/src/addons/block/recentlyaccessedcourses/components/recentlyaccessedcourses/recentlyaccessedcourses.ts index 6bbad0d5d..9eaa906e6 100644 --- a/src/addons/block/recentlyaccessedcourses/components/recentlyaccessedcourses/recentlyaccessedcourses.ts +++ b/src/addons/block/recentlyaccessedcourses/components/recentlyaccessedcourses/recentlyaccessedcourses.ts @@ -135,14 +135,16 @@ export class AddonBlockRecentlyAccessedCoursesComponent extends CoreBlockBaseCom const showCategories = this.block.configsRecord && this.block.configsRecord.displaycategories && this.block.configsRecord.displaycategories.value == '1'; - // WS is failing on 3.7 and 3.6, use a fallback. - if (!this.site.isVersionGreaterEqualThan('3.8')) { + let recentCourses: CoreCourseSummaryData[] = []; + try { + recentCourses = await CoreCourses.getRecentCourses(); + } catch { + // WS is failing on 3.7 and bellow, use a fallback. this.courses = await CoreCoursesHelper.getUserCoursesWithOptions('lastaccess', 10, undefined, showCategories); return; } - const recentCourses = await CoreCourses.getRecentCourses(); const courseIds = recentCourses.map((course) => course.id); // Get the courses using getCoursesByField to get more info about each course.