diff --git a/src/components/progress-bar/progress-bar.ts b/src/components/progress-bar/progress-bar.ts index a77e70291..a7b6df126 100644 --- a/src/components/progress-bar/progress-bar.ts +++ b/src/components/progress-bar/progress-bar.ts @@ -45,15 +45,23 @@ export class CoreProgressBarComponent implements OnChanges { if (changes.progress) { // Progress has changed. - this.width = this.sanitizer.bypassSecurityTrustStyle(this.progress + '%'); if (typeof this.progress == 'string') { this.progress = parseInt(this.progress, 10); } if (this.progress < 0 || isNaN(this.progress)) { this.progress = -1; - } else if (!this.textSupplied) { - this.text = String(this.progress); + } + + if (this.progress != -1) { + // Remove decimals. + this.progress = Math.floor(this.progress); + + if (!this.textSupplied) { + this.text = String(this.progress); + } + + this.width = this.sanitizer.bypassSecurityTrustStyle(this.progress + '%'); } } } diff --git a/src/core/courses/components/course-progress/course-progress.html b/src/core/courses/components/course-progress/course-progress.html index b9cc76d57..e66ef5389 100644 --- a/src/core/courses/components/course-progress/course-progress.html +++ b/src/core/courses/components/course-progress/course-progress.html @@ -1,7 +1,7 @@

- + diff --git a/src/core/courses/pages/my-courses/my-courses.ts b/src/core/courses/pages/my-courses/my-courses.ts index 54ccbb318..ea3941f05 100644 --- a/src/core/courses/pages/my-courses/my-courses.ts +++ b/src/core/courses/pages/my-courses/my-courses.ts @@ -78,7 +78,6 @@ export class CoreCoursesMyCoursesPage implements OnDestroy { return this.coursesProvider.getCoursesOptions(courseIds).then((options) => { courses.forEach((course) => { - course.progress = isNaN(parseInt(course.progress, 10)) ? false : parseInt(course.progress, 10); course.navOptions = options.navOptions[course.id]; course.admOptions = options.admOptions[course.id]; }); diff --git a/src/core/courses/pages/my-overview/my-overview.ts b/src/core/courses/pages/my-overview/my-overview.ts index ce7d535b2..f3643851c 100644 --- a/src/core/courses/pages/my-overview/my-overview.ts +++ b/src/core/courses/pages/my-overview/my-overview.ts @@ -166,8 +166,6 @@ export class CoreCoursesMyOverviewPage { // Load course options of the course. return this.coursesProvider.getCoursesOptions(courseIds).then((options) => { courses.forEach((course) => { - course.progress = isNaN(parseInt(course.progress, 10)) ? false : parseInt(course.progress, 10); - course.navOptions = options.navOptions[course.id]; course.admOptions = options.admOptions[course.id]; });