MOBILE-3806 course: Fix hidden 0% progress

main
Pau Ferrer Ocaña 2021-11-26 14:02:50 +01:00
parent 17305cbac6
commit dcda71f06f
2 changed files with 2 additions and 3 deletions

View File

@ -30,7 +30,7 @@
</ion-item>
<ion-card [attr.course-color]="course.color ? null : course.colorNumber" *ngIf="layout == 'card' || layout == 'summarycard'"
class="core-course-list-card" [class.item-dimmed]="course.hidden" [attr.aria-label]="course.displayname || course.fullname">
class="core-course-list-card" [class.item-dimmed]="course.hidden">
<div (click)="openCourse()" class="core-course-thumb" [class.core-course-color-img]="course.courseImage"
[style.background-color]="course.color">
<img *ngIf="course.courseImage" [src]="course.courseImage" core-external-content alt="" />
@ -51,7 +51,6 @@
<div *ngIf="layout == 'card' && progress >= 0 && completionUserTracked !== false" lines="none" class="core-course-progress">
<core-progress-bar [progress]="progress" a11yText="core.courses.aria:courseprogress"></core-progress-bar>
</div>
</ion-label>
</ion-item>
</ion-card>

View File

@ -157,7 +157,7 @@ export class CoreCoursesCourseListItemComponent implements OnInit, OnDestroy, On
* Helper function to update course fields.
*/
protected updateCourseFields(): void {
this.progress = 'progress' in this.course ? this.course.progress || -1 : -1;
this.progress = 'progress' in this.course && typeof this.course.progress == 'number' ? this.course.progress : -1;
this.completionUserTracked = 'completionusertracked' in this.course && this.course.completionusertracked;
}