MOBILE-3833 timeline: Hide courses without events

main
Pau Ferrer Ocaña 2021-11-08 16:19:08 +01:00
parent 597949d5bd
commit 4c94b61eca
2 changed files with 8 additions and 2 deletions

View File

@ -47,6 +47,6 @@
[course]="course" [from]="dataFrom" [to]="dataTo"></addon-block-timeline-events>
</ng-container>
<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>

View File

@ -176,9 +176,15 @@ export class AddonBlockTimelineComponent extends CoreBlockBaseComponent implemen
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.canLoadMore = courseEvents[course.id].canLoadMore;
return true;
});
}
}