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]; } /**