From 14a3738fba1fbe5e20650ccf4658181357bf3055 Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Tue, 25 Mar 2025 15:39:17 -0700 Subject: [PATCH] add a public method to get the seconds threshold for a scheduled notification --- .../schedulers/ETANotificationScheduler.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/notifications/schedulers/ETANotificationScheduler.ts b/src/notifications/schedulers/ETANotificationScheduler.ts index 234b310..8789cdd 100644 --- a/src/notifications/schedulers/ETANotificationScheduler.ts +++ b/src/notifications/schedulers/ETANotificationScheduler.ts @@ -147,16 +147,17 @@ export class ETANotificationScheduler { /** * Check whether the notification is scheduled. - * @param deviceId - * @param shuttleId - * @param stopId */ - public isNotificationScheduled({ deviceId, shuttleId, stopId }: NotificationLookupArguments): boolean { + public isNotificationScheduled(lookupArguments: NotificationLookupArguments): boolean { + return this.getSecondsThresholdForScheduledNotification(lookupArguments) != null; + } + + public getSecondsThresholdForScheduledNotification({ deviceId, shuttleId, stopId }: NotificationLookupArguments): number | null { const tuple = new TupleKey(shuttleId, stopId); if (this.deviceIdsToDeliverTo[tuple.toString()] === undefined) { - return false; + return null; } - return deviceId in this.deviceIdsToDeliverTo[tuple.toString()]; + return this.deviceIdsToDeliverTo[tuple.toString()][deviceId]; } /**