diff --git a/src/addon/block/myoverview/components/myoverview/myoverview.ts b/src/addon/block/myoverview/components/myoverview/myoverview.ts index ee4f77101..260f37d45 100644 --- a/src/addon/block/myoverview/components/myoverview/myoverview.ts +++ b/src/addon/block/myoverview/components/myoverview/myoverview.ts @@ -150,6 +150,10 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem */ protected fetchContent(): Promise { return this.coursesHelper.getUserCoursesWithOptions(this.sort).then((courses) => { + this.courseIds = courses.map((course) => { + return course.id; + }); + this.showSortFilter = courses.length > 0 && typeof courses[0].lastaccess != 'undefined'; this.initCourseFilters(courses); diff --git a/src/core/courses/providers/courses.ts b/src/core/courses/providers/courses.ts index 3ea3805c2..548069d07 100644 --- a/src/core/courses/providers/courses.ts +++ b/src/core/courses/providers/courses.ts @@ -118,6 +118,11 @@ export class CoreCoursesProvider { // Always add the site home ID. courseIds.push(siteHomeId); + + // Sort the course IDs. + courseIds.sort((a, b) => { + return b - a; + }); } return courseIds; @@ -130,6 +135,11 @@ export class CoreCoursesProvider { courseIds.push(siteHomeId); } + // Sort the course IDs. + courseIds.sort((a, b) => { + return b - a; + }); + return courseIds; } });