add a public method to get the seconds threshold for a scheduled notification

This commit is contained in:
2025-03-25 15:39:17 -07:00
parent 1321ff1347
commit 14a3738fba

View File

@@ -147,16 +147,17 @@ export class ETANotificationScheduler {
/** /**
* Check whether the notification is scheduled. * 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); const tuple = new TupleKey(shuttleId, stopId);
if (this.deviceIdsToDeliverTo[tuple.toString()] === undefined) { if (this.deviceIdsToDeliverTo[tuple.toString()] === undefined) {
return false; return null;
} }
return deviceId in this.deviceIdsToDeliverTo[tuple.toString()]; return this.deviceIdsToDeliverTo[tuple.toString()][deviceId];
} }
/** /**