From cd582f4f877ccd84cdfe6ea885e493272a283f77 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Fri, 21 Dec 2018 11:57:56 +0100 Subject: [PATCH] MOBILE-2801 course: Fix update displayname in overview --- .../myoverview/components/myoverview/myoverview.ts | 4 ++++ src/core/courses/providers/courses.ts | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/addon/block/myoverview/components/myoverview/myoverview.ts b/src/addon/block/myoverview/components/myoverview/myoverview.ts index 59b87cb3f..62dea39b4 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; } });