From ab89665078e856dcfc7a41349cb95cb986eb6d2d Mon Sep 17 00:00:00 2001 From: Scott Straughan Date: Thu, 25 Jul 2024 10:27:34 +0100 Subject: [PATCH 1/2] Small bug fix. --- src/app/pages/home/home.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/pages/home/home.component.ts b/src/app/pages/home/home.component.ts index 4dd179d..823a02a 100644 --- a/src/app/pages/home/home.component.ts +++ b/src/app/pages/home/home.component.ts @@ -155,7 +155,7 @@ export class HomeComponent implements SearchablePage { { initialValue: PlaygroundSampleService.getDefaultSample() }); this.projectCount = toSignal( - this.eventService.count(), { initialValue: 0 }); + this.projectService.count(), { initialValue: 0 }); this.videoCount = toSignal( this.videoService.count(), { initialValue: 0 }); From b8f3265c5ddd332b90b5fcfb6da57a68fd60d1b4 Mon Sep 17 00:00:00 2001 From: Scott Straughan Date: Thu, 25 Jul 2024 10:27:53 +0100 Subject: [PATCH 2/2] Updated events page to use upcoming events rather than "all". --- src/app/pages/home/home.component.ts | 2 +- src/app/shared/services/models/event.service.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/pages/home/home.component.ts b/src/app/pages/home/home.component.ts index 823a02a..2a6b861 100644 --- a/src/app/pages/home/home.component.ts +++ b/src/app/pages/home/home.component.ts @@ -136,7 +136,7 @@ export class HomeComponent implements SearchablePage { this.communityUpdateService.all(6), { initialValue: [] }); this.events = toSignal( - this.eventService.all(4), { initialValue: [] }); + this.eventService.getUpcomingEvents(4), { initialValue: [] }); this.yearlyEventCount = toSignal( this.eventService.getYearlyEventCount(new Date().getFullYear()), { initialValue: 0 } ); diff --git a/src/app/shared/services/models/event.service.ts b/src/app/shared/services/models/event.service.ts index 72a4051..24dabc9 100644 --- a/src/app/shared/services/models/event.service.ts +++ b/src/app/shared/services/models/event.service.ts @@ -108,7 +108,8 @@ export class EventService extends JsonFeedService { map(events => events.filter((event) => { return event.starts > currentDateTime ? event : null; })), - map(events => limit ? events.slice(offset, limit) : events.slice(offset)) + map(events => limit ? events.slice(offset, limit) : events.slice(offset)), + map(events => events.sort((a, b) => (a.starts > b.starts) ? 1 : -1)) ); }