MOBILE-3833 timeline: Hide courses without events
parent
597949d5bd
commit
4c94b61eca
|
@ -47,6 +47,6 @@
|
||||||
[course]="course" [from]="dataFrom" [to]="dataTo"></addon-block-timeline-events>
|
[course]="course" [from]="dataFrom" [to]="dataTo"></addon-block-timeline-events>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<core-empty-box *ngIf="timelineCourses.courses.length == 0" image="assets/img/icons/courses.svg" inline="true"
|
<core-empty-box *ngIf="timelineCourses.courses.length == 0" image="assets/img/icons/courses.svg" inline="true"
|
||||||
[message]="'addon.block_timeline.nocoursesinprogress' | translate"></core-empty-box>
|
[message]="'addon.block_timeline.noevents' | translate"></core-empty-box>
|
||||||
</core-loading>
|
</core-loading>
|
||||||
</core-loading>
|
</core-loading>
|
||||||
|
|
|
@ -176,9 +176,15 @@ export class AddonBlockTimelineComponent extends CoreBlockBaseComponent implemen
|
||||||
|
|
||||||
const courseEvents = await AddonBlockTimeline.getActionEventsByCourses(this.courseIds);
|
const courseEvents = await AddonBlockTimeline.getActionEventsByCourses(this.courseIds);
|
||||||
|
|
||||||
this.timelineCourses.courses.forEach((course) => {
|
this.timelineCourses.courses = this.timelineCourses.courses.filter((course) => {
|
||||||
|
if (courseEvents[course.id].events.length == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
course.events = courseEvents[course.id].events;
|
course.events = courseEvents[course.id].events;
|
||||||
course.canLoadMore = courseEvents[course.id].canLoadMore;
|
course.canLoadMore = courseEvents[course.id].canLoadMore;
|
||||||
|
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue