From d95a522c8d745d14808c8943f043fe86f93103d4 Mon Sep 17 00:00:00 2001 From: Scott Straughan Date: Thu, 3 Oct 2024 16:06:47 +0100 Subject: [PATCH] Fixed an issue where events are being sliced before being sorted resulting in missing upcoming events. --- src/app/pages/home/home.component.ts | 3 +-- src/app/shared/services/models/event.service.ts | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/app/pages/home/home.component.ts b/src/app/pages/home/home.component.ts index 0b9c681..ea42ede 100644 --- a/src/app/pages/home/home.component.ts +++ b/src/app/pages/home/home.component.ts @@ -99,6 +99,7 @@ export class HomeComponent implements SearchablePage, OnInit, OnDestroy { protected readonly Layout = NewsWidgetLayout; protected readonly CommunityUpdateModelType = ImplementationActivityType; + protected readonly environment = environment; /** * Constructor @@ -217,6 +218,4 @@ export class HomeComponent implements SearchablePage, OnInit, OnDestroy { getDefaultRoutePath() { return '/'; } - - protected readonly environment = environment; } diff --git a/src/app/shared/services/models/event.service.ts b/src/app/shared/services/models/event.service.ts index e72d14d..8e064cf 100644 --- a/src/app/shared/services/models/event.service.ts +++ b/src/app/shared/services/models/event.service.ts @@ -109,8 +109,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 => events.sort((a, b) => (a.starts > b.starts) ? 1 : -1)) + map(events => events.sort((a, b) => (a.starts > b.starts) ? 1 : -1)), + map(events => limit ? events.slice(offset, limit) : events.slice(offset)) ); }